Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 31, 2024

Make sure that gilstate_counter is not zero in when calling
PyThreadState_Clear(). A destructor called from PyThreadState_Clear() may
call back into PyGILState_Ensure() and PyGILState_Release(). If
gilstate_counter is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be3)

Co-authored-by: Sam Gross [email protected]

…readState_Clear()` (pythonGH-119753)

Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be3)

Co-authored-by: Sam Gross <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants