-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-103323: Get the "Current" Thread State from a Thread-Local Variable #103324
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
Merged
ericsnowcurrently
merged 12 commits into
python:main
from
ericsnowcurrently:tstate_current-as-thread_local
Apr 24, 2023
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c4db85a
Add a thread_local macro.
ericsnowcurrently 47a7094
tstate_current -> thread_local.
ericsnowcurrently cf22de1
Add _PyThraedState_GetCurrent().
ericsnowcurrently d4136d2
Add HAVE_THREAD_LOCAL.
ericsnowcurrently f8c6598
Support the faster approach, if available.
ericsnowcurrently 9496df0
Do not fail if thread_local not supported.
ericsnowcurrently 2c335a3
thread_local -> _Py_thread_local
ericsnowcurrently 4af0ce7
Only define _Py_thread_local for the core runtime.
ericsnowcurrently 3db4007
Fix pystate.c.
ericsnowcurrently d573053
Call _PyThreadState_GET() from _PyRuntimeState_GetThreadState().
ericsnowcurrently feb8ef5
Fix the error message.
ericsnowcurrently 2332a2e
Add a NEWS entry.
ericsnowcurrently File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add _PyThraedState_GetCurrent().
- Loading branch information
commit cf22de1b1229033aac3eb780eaad889fafe9c6c6
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case for this new _PyThreadState_GetCurrent() function? There is already PyThreadState_Get(). How is it different?
The API to get the current thread state is already complicated and has a complicated history: https://pythondev.readthedocs.io/pystate.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's there because I couldn't find a way to mix
PyAPI_DATA
with_Py_thread_local
. Looks like that's the same issue you ran into in 2020.