GeezerVison is showing github.com — C API: Remove Include/errcode.h header file · Issue #107162 · python/cpython
C API: Remove Include/errcode.h header file #107162DescriptionConstants 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.
In Python 3.10, I removed the C API related to AST and the parser, since it was not possible to use it outside Python internals. See: https://docs.python.org/dev/whatsnew/3.10.html#id4
Linked PRs
Activityserhiy-storchaka commented on Jul 24, 2023 It is the part of the C API. See PyRun_InteractiveOneFlags() documentation. vstinner commented on 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_ or PY_. But since it's not included by Python, maybe it's not really an issue. vstinner commented on 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 public PyRun_InteractiveOneFlags() function. I wrote it directly the header file for future readers: 7516953 serhiy-storchaka commented on Jul 25, 2023 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. vstinner commented on Jul 25, 2023
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 :-)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|