diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-06-16 22:59:07 -0700 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-06-16 22:59:07 -0700 |
commit | 19f48b63383721cee8c02d043d3aa6f364b24b4f (patch) | |
tree | 16466426063e54624e7385e43f95b87f0e81660c | |
parent | 821ae956ccb2d1ef5b16a7e056afb3b1b3df19e7 (diff) | |
download | cpython-19f48b63383721cee8c02d043d3aa6f364b24b4f.tar.gz |
check if the thread is finalizing after retaking the GIL
-rw-r--r-- | Python/ceval.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index b1f5e8eedb..e00860831f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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"); |