Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C API] Remove token.h header file #92651

Closed
vstinner opened this issue May 11, 2022 · 1 comment
Closed

[C API] Remove token.h header file #92651

vstinner opened this issue May 11, 2022 · 1 comment
Labels
topic-C-API type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

Symbols and functions exported by the <token.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. It's not included by Python.h.

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

@vstinner vstinner added type-bug An unexpected behavior, bug, or error topic-C-API labels May 11, 2022
vstinner added a commit that referenced this issue May 11, 2022
Remove the token.h header file. There was never any public tokenizer
C API. The token.h header file was only designed to be used by Python
internals.

Move Include/token.h to Include/internal/pycore_token.h. Including
this header file now requires that the Py_BUILD_CORE macro is
defined. It no longer checks for the Py_LIMITED_API macro.

Rename functions:

* PyToken_OneChar() => _PyToken_OneChar()
* PyToken_TwoChars() => _PyToken_TwoChars()
* PyToken_ThreeChars() => _PyToken_ThreeChars()
@vstinner
Copy link
Member Author

Fixed by da5727a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-C-API type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant