Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 774479c

Browse files
author
Michael W. Hudson
committed
Fix:
[ 1176893 ] Readline segfault by unsilly-ing PyGILState_Release(). Backport candidate.
1 parent 6d22b56 commit 774479c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ What's New in Python 2.5 alpha 1?
1212
Core and builtins
1313
-----------------
1414

15+
- It is now safe to call PyGILState_Release() before
16+
PyEval_InitThreads() (note that if there is reason to believe there
17+
are multiple threads around you still must call PyEval_InitThreads()
18+
before using the Python API; this fix is for extension modules that
19+
have no way of knowing if Python is multi-threaded yet).
20+
1521
- Typing Ctrl-C whilst raw_input() was waiting in a build with threads
1622
disabled caused a crash.
1723

Python/pystate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,6 @@ PyGILState_Release(PyGILState_STATE oldstate)
503503
}
504504
/* Release the lock if necessary */
505505
else if (oldstate == PyGILState_UNLOCKED)
506-
PyEval_ReleaseThread(tcur);
506+
PyEval_SaveThread();
507507
}
508508
#endif /* WITH_THREAD */

0 commit comments

Comments
 (0)