]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport my recent fix (rev. 2.40 of Python/pystate.c):
authorMichael W. Hudson <mwh@python.net>
Sun, 24 Apr 2005 19:32:34 +0000 (19:32 +0000)
committerMichael W. Hudson <mwh@python.net>
Sun, 24 Apr 2005 19:32:34 +0000 (19:32 +0000)
Fix:

1176893 ] Readline segfault

by unsilly-ing PyGILState_Release().

Backport candidate.

Misc/NEWS
Python/pystate.c

index af55fb7c95d32836e88e30c2ff675a3e10dbc7b9..24068580e7476399c350b8c4d4840f8352eb3a93 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,12 @@ What's New in Python 2.4.2a
 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 */