diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-11 21:22:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 21:22:50 (GMT) |
commit | da5727a120e426ffaf68bf3a8016491205bd2f80 (patch) | |
tree | a1d551bbc55b420de3f7c68b69a05fdf080e83f2 /Include | |
parent | b69297ea23c0ab9866ae8bd26a347a9b5df567a6 (diff) | |
download | cpython-da5727a120e426ffaf68bf3a8016491205bd2f80.zip cpython-da5727a120e426ffaf68bf3a8016491205bd2f80.tar.gz cpython-da5727a120e426ffaf68bf3a8016491205bd2f80.tar.bz2 |
gh-92651: Remove the Include/token.h header file (#92652)
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()
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_token.h (renamed from Include/token.h) | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Include/token.h b/Include/internal/pycore_token.h index eb1b9ea..f9b8240 100644 --- a/Include/token.h +++ b/Include/internal/pycore_token.h @@ -1,13 +1,16 @@ /* Auto-generated by Tools/scripts/generate_token.py */ /* Token types */ -#ifndef Py_LIMITED_API -#ifndef Py_TOKEN_H -#define Py_TOKEN_H +#ifndef Py_INTERNAL_TOKEN_H +#define Py_INTERNAL_TOKEN_H #ifdef __cplusplus extern "C" { #endif +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ #define ENDMARKER 0 @@ -85,13 +88,13 @@ extern "C" { (x) == DEDENT) +// Symbols exported for test_peg_generator PyAPI_DATA(const char * const) _PyParser_TokenNames[]; /* Token names */ -PyAPI_FUNC(int) PyToken_OneChar(int); -PyAPI_FUNC(int) PyToken_TwoChars(int, int); -PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); +PyAPI_FUNC(int) _PyToken_OneChar(int); +PyAPI_FUNC(int) _PyToken_TwoChars(int, int); +PyAPI_FUNC(int) _PyToken_ThreeChars(int, int, int); #ifdef __cplusplus } #endif -#endif /* !Py_TOKEN_H */ -#endif /* Py_LIMITED_API */ +#endif // !Py_INTERNAL_TOKEN_H |