summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-17 05:59:07 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-06-17 05:59:07 (GMT)
commit1c78e6d96f48c8b779ddc988366fece38de1f698 (patch)
treef1a576d920e1568188f0ed3b47a708f9a72db8cc /Python/ceval.c
parentc0bc4eff5093bd4268cb3d02b9dca2fcbe7e59ca (diff)
downloadcpython-1c78e6d96f48c8b779ddc988366fece38de1f698.zip
cpython-1c78e6d96f48c8b779ddc988366fece38de1f698.tar.gz
cpython-1c78e6d96f48c8b779ddc988366fece38de1f698.tar.bz2
check if the thread is finalizing after retaking the GIL
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b1f5e8e..e008608 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");