]> granicus.if.org Git - python/commitdiff
Fix:
authorMichael W. Hudson <mwh@python.net>
Mon, 18 Apr 2005 08:46:17 +0000 (08:46 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 18 Apr 2005 08:46:17 +0000 (08:46 +0000)
1176893 ] Readline segfault

by unsilly-ing PyGILState_Release().

Backport candidate.

Misc/NEWS
Python/pystate.c

index f1551b12d895ec8ed7615573336a4c0e4864c163..ec30734f30d8129f93526fdece387e524bb983f2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,12 @@ What's New in Python 2.5 alpha 1?
 Core and builtins
 -----------------
 
+- It is now safe to call PyGILState_Release() before
+  PyEval_InitThreads() (note that if there is reason to believe there
+  are multiple threads around you still must call PyEval_InitThreads()
+  before using the Python API; this fix is for extension modules that
+  have no way of knowing if Python is multi-threaded yet).
+
 - Typing Ctrl-C whilst raw_input() was waiting in a build with threads
   disabled caused a crash.
 
index 255cf7e86e82a8492f52515a162f42b297581687..abca8ddfdff1444f3ee9528084ee05c9e28ca302 100644 (file)
@@ -503,6 +503,6 @@ PyGILState_Release(PyGILState_STATE oldstate)
        }
        /* Release the lock if necessary */
        else if (oldstate == PyGILState_UNLOCKED)
-               PyEval_ReleaseThread(tcur);
+               PyEval_SaveThread();
 }
 #endif /* WITH_THREAD */