forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-119585: Fix crash involving
PyGILState_Release()
and `PyTh…
…readState_Clear()` Don't decrement `gilstate_counter` in `PyGILState_Release()` until after `PyThreadState_Clear()` is called. A destructor called from `PyThreadState_Clear()` may call back into `PyGILState_Ensure()` and PyGILState_Release()` and if `gilstate_counter` is zero, it will try to create a new thread state before the current active thread state is destroyed.
- Loading branch information
Showing
4 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
5 changes: 5 additions & 0 deletions
5
Misc/NEWS.d/next/C API/2024-05-29-21-05-59.gh-issue-119585.Sn7JL3.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Fix crash when a thread state that was created by :c:func:`PyGILState_Ensure` | ||
calls a destructor that during :c:func:`PyThreadState_Clear` that | ||
calls back into :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`. | ||
This might occur when in the free-threaded build or when using thread-local | ||
variables whose destructors call :c:func:`PyGILState_Ensure`. |
This file contains 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 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