summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-13 14:16:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-13 14:16:46 (GMT)
commit1df1536fb98c1c2bbeefe373bc38877129f905e1 (patch)
treea1489c86f4f1ea5b0645afcabf8aee765826d18a /Python/pythonrun.c
parentbea8ae794873485eef1b0c0c20b374df99858430 (diff)
downloadcpython-1df1536fb98c1c2bbeefe373bc38877129f905e1.zip
cpython-1df1536fb98c1c2bbeefe373bc38877129f905e1.tar.gz
cpython-1df1536fb98c1c2bbeefe373bc38877129f905e1.tar.bz2
Issue #9828: Destroy the GIL in Py_Finalize(), so that it gets properly
re-created on a subsequent call to Py_Initialize(). The problem (a crash) wouldn't appear in 3.1 or 2.7 where the GIL's structure is more trivial.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index fd31974..8f4e9f1 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -514,6 +514,10 @@ Py_Finalize(void)
PyGrammar_RemoveAccelerators(&_PyParser_Grammar);
+#ifdef WITH_THREAD
+ _PyEval_FiniThreads();
+#endif
+
#ifdef Py_TRACE_REFS
/* Display addresses (& refcnts) of all objects still alive.
* An address can be used to find the repr of the object, printed