Commit 2f0a8ee3 authored by Benjamin Peterson's avatar Benjamin Peterson

check if the thread is finalizing after retaking the GIL

parent d58f9abe
......@@ -1024,6 +1024,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
/* Other threads may run now */
PyThread_acquire_lock(interpreter_lock, 1);
/* Check if we should make a quick exit. */
if (_Py_Finalizing && _Py_Finalizing != tstate) {
PyThread_release_lock(interpreter_lock);
PyThread_exit_thread();
}
if (PyThreadState_Swap(tstate) != NULL)
Py_FatalError("ceval: orphan tstate");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment