Closed
Description
The documentation for PyThreadState_DeleteCurrent()
says:
Destroy the current thread state and release the global interpreter lock. Like PyThreadState_Delete(), the global interpreter lock need not be held. The thread state must have been reset with a previous call to PyThreadState_Clear().
However, calling the function without holding the GIL results in a fatal Python error:
Fatal Python error: _PyThreadState_DeleteCurrent: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)
It looks to me like like CPython code since at least 3.8 required holding the GIL when calling PyThreadState_DeleteCurrent()
, so I think we should update the documentation rather than change the implementation.