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.

Title: readline update
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, doko, jrevans1, pitrou, sandro.tosi, spatz, terry.reedy
Priority: normal Keywords: patch

Created on 2009-04-24 20:46 by jrevans1, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
Python.patch jrevans1, 2009-04-24 20:46
python-2.6-readline.patch spatz, 2009-07-29 19:35
Messages (14)
msg86432 - (view) Author: J. Evans (jrevans1) Date: 2009-04-24 20:46
Attached is a patch file that will update the readline functionality of
python in the following ways:
-- makes the tab-expand module be compatible with readline v6.x (fixes
the annoying extra-space bug)
-- removes '~$-/' from the completer chars list to make the next item work
-- adds filename completion to the completer, this is useful whenever a
filename/path is used
-- allows expansion to work properly on ClassType objects
msg90978 - (view) Author: Dror Levin (spatz) Date: 2009-07-27 07:51
This bug was reported in Arch ( and
Gentoo (
msg90981 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-07-27 13:57
The patch should be broken into several, one for each bug fix or

Remarks and questions:
- is the readline v6.x fix (which I'm interested in) compatible with
previous readline versions?
- what does "removes '~$-/' from the completer chars list to make the
next item work" mean exactly? is it a bugfix or a new feature?
- I'm not sure filename completion is uncontroversial, it's the kind of
advanced features which we usually let third-party tools (e.g. IPython)
handle if they want to; it may also cause spurious IOs and error messages
msg90996 - (view) Author: J. Evans (jrevans1) Date: 2009-07-27 20:10
Some clarification about the rest of the patch:

-- We tested the readline fix with version 5.2 and it seemed to work, we
did not do a thorough test with it, or with any other version.

-- When I supplied the patch I supplied the patch that we use when
building python, which also included some enhancements/bug fixes
(depending on how you look at it).  By removing the '~$-/' characters
from the completer list it allows the user to perform file name
completion (with the provided file name completion code).  The file name
completion code has been very rigorously tested.  We have been using it
at our company for the past 10 years with >100 users and have had no
problems with it.

-- We put this here since it never really seemed to be an advanced
feature since readline completion will complete file names on the
command-line as well.  This seemed like a relatively low-level fix that
makes the python tab-expansion facility fully usable instead of just
partly usable.

If you would like me to resubmit the patch as smaller components I can
do that as well.
msg91066 - (view) Author: Dror Levin (spatz) Date: 2009-07-29 19:35
Arch Linux devs have split the patch and applied only the extra-space
fix, which is what I'm attaching now. I've compiled Python 2.6.2 on
Gentoo with this patch and can report it works well (I tested with ipython).
msg94248 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-19 18:25
I've committed the readline 6.0 fix to trunk, py3k and 3.1. I'll commit
it to 2.6 when the branch is unfrozen.
msg94560 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-27 13:12
Now backported to py3k in r75747.
msg95476 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2009-11-19 14:37
msg94560 should read "backported to the 2.6 branch". can we close the
msg95479 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-19 15:02
> Can we close the report?

Well there's something else in the original patch, although I don't care
about it.
msg128229 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2011-02-09 18:25
How should we move forward with this issue?
J Evens: are you willing to split the patch in smaller ones that can be more easily managed/reviewed/applied?
Antoine: do you think it's worth the effort?

I can also try to split the patch, but what branch should I target: py3k?
msg128306 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-10 16:53
> Antoine: do you think it's worth the effort?

As mentioned above, the readline 6 compatibility code was checked in.
The ClassType expansion is 2.x-only, so probably can't go in since it's a feature request.
What remains is the filename expansion. However, the problem is that it seems to rely on removing '~$-/' from the word break characters, which is IMO wrong (at least '-', '/' and '~' are all Python operators which should be considered word break characters).
msg128319 - (view) Author: J. Evans (jrevans1) Date: 2011-02-10 17:40
I have no problem splitting the patch into multiple files.  When I do so, do I place them here or open separate tickets for each component?

Or if you guys want to just close out the ticket since the actual bug was fixed, I am okay with that too.  We will probably continue to use the patched version of tabexpand for our users since the filename expansion is used quite heavily.  And since we will not be transitioning to py3k anytime in the next several years, we have no issue with what is (or is not) implemented there.
msg224189 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-28 21:10
Looking at msg128306 and msg128319 I believe this can be closed.
msg226086 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-29 21:16
Bug was fixed. Enhancements are out of date for 2.x and OP will not pursue for 3.x, and should be a separate issue anyway.
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50083
2014-08-29 21:16:22terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg226086

resolution: fixed
stage: resolved
2014-07-28 21:10:56BreamoreBoysetnosy: + BreamoreBoy
messages: + msg224189
2011-02-10 17:40:01jrevans1setnosy: doko, pitrou, spatz, jrevans1, sandro.tosi
messages: + msg128319
2011-02-10 16:53:11pitrousetnosy: doko, pitrou, spatz, jrevans1, sandro.tosi
messages: + msg128306
2011-02-09 18:25:17sandro.tosisetnosy: + sandro.tosi
messages: + msg128229
2009-11-19 15:02:01pitrousetmessages: + msg95479
2009-11-19 14:37:58dokosetnosy: + doko
messages: + msg95476
2009-10-27 13:12:04pitrousetmessages: + msg94560
2009-10-19 18:25:40pitrousetmessages: + msg94248
2009-07-29 19:35:50spatzsetfiles: + python-2.6-readline.patch

messages: + msg91066
2009-07-27 20:10:35jrevans1setmessages: + msg90996
2009-07-27 13:57:56pitrousetpriority: normal
versions: + Python 3.1, Python 2.7, Python 3.2
nosy: + pitrou

messages: + msg90981

type: behavior
2009-07-27 13:50:30pitroulinkissue5992 superseder
2009-07-27 07:51:30spatzsetnosy: + spatz
messages: + msg90978
2009-04-24 20:46:32jrevans1create