From: Michael W. Hudson Date: Sun, 24 Apr 2005 19:32:34 +0000 (+0000) Subject: Backport my recent fix (rev. 2.40 of Python/pystate.c): X-Git-Tag: v2.4.2c1~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14ef205309bf019c28fea1c253bf6b42aba117fe;p=thirdparty%2FPython%2Fcpython.git Backport my recent fix (rev. 2.40 of Python/pystate.c): Fix: [ 1176893 ] Readline segfault by unsilly-ing PyGILState_Release(). Backport candidate. --- diff --git a/Misc/NEWS b/Misc/NEWS index af55fb7c95d3..24068580e747 100644 --- 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. diff --git a/Python/pystate.c b/Python/pystate.c index 255cf7e86e82..abca8ddfdff1 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -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 */