bpo-35081: Add _PyThreadState_GET() internal macro#10266
Merged
vstinner merged 2 commits intopython:masterfrom Nov 1, 2018
vstinner:pythreadstate_get
Merged
bpo-35081: Add _PyThreadState_GET() internal macro#10266vstinner merged 2 commits intopython:masterfrom vstinner:pythreadstate_get
vstinner merged 2 commits intopython:masterfrom
vstinner:pythreadstate_get
Conversation
Member
Author
|
Travis CI failed on running doctests: |
If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access _PyRuntime which comes from the internal pycore_state.h header. Public headers must not require internal headers. Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from Include/pystate.h to Include/internal/pycore_state.h, and rename PyThreadState_GET() to _PyThreadState_GET() there. The PyThreadState_GET() macro of pystate.h is now redefined when pycore_state.h is included, to use the fast _PyThreadState_GET(). Changes: * Add _PyThreadState_GET() macro * Replace "PyThreadState_GET()->interp" with _PyInterpreterState_GET_UNSAFE() * Replace PyThreadState_GET() with _PyThreadState_GET() in internal C files (compiled with Py_BUILD_CORE defined), but keep PyThreadState_GET() in the public header files. * _testcapimodule.c: replace PyThreadState_GET() with PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE defined. * pycore_state.h now requires Py_BUILD_CORE to be defined.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PyThreadState_GET() is a macro accessing
_PyRuntime.gilstate.tstate_current variable or calling
PyThreadState_Get() depending on Py_BUILD_CORE.
Add a new _PyThreadState_GET() internal macro which is always
the efficient macro accessing directly the variable. _PyThreadState_GET()
is not available if Py_BUILD_CORE is not defined.
Changes:
_PyInterpreterState_GET_UNSAFE()
files, but keep PyThreadState_GET() in the public API.
PyThreadState_Get(), the module is not compiled with Py_BUILD_CORE
defined.
https://bugs.python.org/issue35081