SIGN IN SIGN UP

gh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()` (#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.
S
Sam Gross committed
bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c
Parent: 891c1e3
Committed by GitHub <noreply@github.com> on 5/31/2024, 2:50:52 PM