This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Readline segfault
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mwh Nosy List: doerwalter, mwh, tim.peters
Priority: normal Keywords:

Created on 2005-04-05 08:50 by doerwalter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
release-thread-check.diff mwh, 2005-04-05 10:27 mwh's patch #1
Messages (5)
msg24883 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-04-05 08:50
The latest change to the readline module has broken tab
completion:

./python
Python 2.5a0 (#1, Apr  5 2005, 01:14:33) 
[GCC 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3,
pie-8.7.7.1)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import readline, rlcompleter
[25913 refs]
>>> readline.parse_and_bind("tab: complete")
[25913 refs]
>>> Segmentation fault

[Press tab after the parse_and_bind() call]
msg24884 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-04-05 10:18
Logged In: YES 
user_id=6656

I'm going to go out on a limb and suggest this is a bug in
the PyGilState_ functions.

The problem burrows down to calling
PyThread_release_lock(interpreter_lock) when
interpreter_lock is NULL, i.e. PyEval_InitThreads hasn't
been called. (if you start a thread before running the
crashing code, it doesn't crash, because the GIL has been
allocated).

Not sure what the solution is, or who to bug (time to read
cvs log, I guess).
A silly workaround is to put PyEval_InitThreads in initreadline.
msg24885 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-04-05 10:27
Logged In: YES 
user_id=6656

Or maybe this one line patch is the answer (it certainly
fixes this case).

Tim, can you spare a minute to think about this?  The patch
simply adds a check to PyEval_ReleaseThread that doesn't
call PyThread_release_lock if the GIL hasn't been allocated.
msg24886 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-04-07 15:15
Logged In: YES 
user_id=31435

Sorry, can't make time for this.  Reassigned to Mark in case 
he can.
msg24887 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-04-18 08:50
Logged In: YES 
user_id=6656

Fixed in

Python/pystate.c revision 2.40
Misc/NEWS revision 1.1285

If Mark is actually listening and has any comments, I'd still be interested 
to hear them.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41806
2005-04-05 08:50:47doerwaltercreate