summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-29 23:35:25 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-29 23:35:25 +0000
commitbf776d0b0820d50ac6a20989b59abfd439838684 (patch)
tree71dbe2d6f246a681deb8b52a532899a94eafbe28 /Python/pythonrun.c
parent6aa298466f1ed5a02129fe0689fb01a81dd67ad3 (diff)
downloadcpython-bf776d0b0820d50ac6a20989b59abfd439838684.tar.gz
Issue #1402: PyInterpreterState_Clear() may still invoke user code
(in deallocation of running threads, for example), so the PyGILState_Release() function must still be functional. On the other hand, _PyGILState_Fini() only frees memory, and can be called later. Backport candidate, but only after some experts comment on it.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 96602ff15b..adae679057 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -437,11 +437,6 @@ Py_Finalize(void)
_Py_PrintReferences(stderr);
#endif /* Py_TRACE_REFS */
- /* Cleanup auto-thread-state */
-#ifdef WITH_THREAD
- _PyGILState_Fini();
-#endif /* WITH_THREAD */
-
/* Clear interpreter state */
PyInterpreterState_Clear(interp);
@@ -453,6 +448,11 @@ Py_Finalize(void)
_PyExc_Fini();
+ /* Cleanup auto-thread-state */
+#ifdef WITH_THREAD
+ _PyGILState_Fini();
+#endif /* WITH_THREAD */
+
/* Delete current thread */
PyThreadState_Swap(NULL);
PyInterpreterState_Delete(interp);