summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-29 23:35:25 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-29 23:35:25 (GMT)
commit025c347d611cb58a2cfc3671615891bd3bc1217a (patch)
tree93be5e148ee7faed71a6c20ea115306133b43844 /Python
parent82225b77372746c39ab4efd752b52ebaa227efe8 (diff)
downloadcpython-025c347d611cb58a2cfc3671615891bd3bc1217a.zip
cpython-025c347d611cb58a2cfc3671615891bd3bc1217a.tar.gz
cpython-025c347d611cb58a2cfc3671615891bd3bc1217a.tar.bz2
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')
-rw-r--r--Python/pythonrun.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 96602ff..adae679 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);