Commit 8c270ac8 authored by Benjamin Peterson's avatar Benjamin Peterson

check if the thread is finalizing after retaking the GIL

parent 5f2dd850
...@@ -1267,6 +1267,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) ...@@ -1267,6 +1267,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
/* Other threads may run now */ /* Other threads may run now */
take_gil(tstate); take_gil(tstate);
/* Check if we should make a quick exit. */
if (_Py_Finalizing && _Py_Finalizing != tstate) {
drop_gil(tstate);
PyThread_exit_thread();
}
if (PyThreadState_Swap(tstate) != NULL) if (PyThreadState_Swap(tstate) != NULL)
Py_FatalError("ceval: orphan tstate"); 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