summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 43a5c90..705ed41 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -440,6 +440,12 @@ PyEval_RestoreThread(PyThreadState *tstate)
if (gil_created()) {
int err = errno;
take_gil(tstate);
+ /* _Py_Finalizing is protected by the GIL */
+ if (_Py_Finalizing && tstate != _Py_Finalizing) {
+ drop_gil(tstate);
+ PyThread_exit_thread();
+ assert(0); /* unreachable */
+ }
errno = err;
}
#endif