You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C API: Remove Include/errcode.h header file #107162
Constants exported by the <errcode.h> header file cannot be used outside Python internals. There is no public C API to tokenize a Python source file. I propose to simply remove this header file (move it to the internal C API). It's not included by Python.h.
In Python 3.12, I removed <token.h > header file: see issue #92651.
Oh! I looked for errcode.h usage and I couldn't find it. Thanks for pointing me to this function.
I didn't know that these constants are not only used by the tokenizer, but also by the "high-level" API.
Maybe we should just better document this header file. One concern is that constant names are not prefixed by Py_ or PY_. But since it's not included by Python, maybe it's not really an issue.
I close this issue which is wrong: the <errcode.h> header file is part of the Python C API and used by public PyRun_InteractiveOneFlags() function. I wrote it directly the header file for future readers: 7516953
I am sure that you can use PyRun_InteractiveOneFlags() even without errcode.h. But if you want to get more details about parsing error, you can include errcode.h.
Since PyRun_InteractiveOneFlags() can also return -1 and set an exception, we perhaps can get rid of these error codes and turn them into appropriate Python exceptions. errcode.h then became obsolete.
Since PyRun_InteractiveOneFlags() can also return -1 and set an exception, we perhaps can get rid of these error codes and turn them into appropriate Python exceptions. errcode.h then became obsolete.
Well, if you want to try that, you can propose a change :-)
Activity
pythongh-107162: Remove errcode.h header file
pythongh-107162: Remove errcode.h header file
serhiy-storchaka commentedon Jul 24, 2023
It is the part of the C API. See
PyRun_InteractiveOneFlags()documentation.vstinner commentedon Jul 24, 2023
https://docs.python.org/dev/c-api/veryhigh.html#c.PyRun_InteractiveOneFlags
Oh! I looked for errcode.h usage and I couldn't find it. Thanks for pointing me to this function.
I didn't know that these constants are not only used by the tokenizer, but also by the "high-level" API.
Maybe we should just better document this header file. One concern is that constant names are not prefixed by
Py_orPY_. But since it's not included by Python, maybe it's not really an issue.pythongh-107162: Document errcode.h usage in its comment
pythongh-107162: Document errcode.h usage in its comment
gh-107162: Document errcode.h usage in its comment (#107177)
pythongh-107162: Document errcode.h usage in its comment (python#107177)
vstinner commentedon Jul 24, 2023
I close this issue which is wrong: the
<errcode.h>header file is part of the Python C API and used by publicPyRun_InteractiveOneFlags()function. I wrote it directly the header file for future readers: 7516953Merge branch 'main' into superfix
serhiy-storchaka commentedon Jul 25, 2023
I am sure that you can use
PyRun_InteractiveOneFlags()even withouterrcode.h. But if you want to get more details about parsing error, you can includeerrcode.h.Since
PyRun_InteractiveOneFlags()can also return-1and set an exception, we perhaps can get rid of these error codes and turn them into appropriate Python exceptions.errcode.hthen became obsolete.vstinner commentedon Jul 25, 2023
Well, if you want to try that, you can propose a change :-)