summaryrefslogtreecommitdiffstats
path: root/Python
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)
commit17548dda51ddd2fdc7641d8808b8f458f7f339fe (patch)
tree8c22e51d8e129c6aa39166b1c6886e9469d00e45 /Python
parent663756529804830af7816685c72b335563c554b8 (diff)
downloadcpython-17548dda51ddd2fdc7641d8808b8f458f7f339fe.zip
cpython-17548dda51ddd2fdc7641d8808b8f458f7f339fe.tar.gz
cpython-17548dda51ddd2fdc7641d8808b8f458f7f339fe.tar.bz2
check if the thread is finalizing after retaking the GIL
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 1cc3c94..bafb88c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1267,6 +1267,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
/* Other threads may run now */
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)
Py_FatalError("ceval: orphan tstate");
}