Issue 5845: rlcompleter should be enabled automatically (original) (raw)
Created on 2009-04-25 23:27 by cben, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (66)
Author: Cherniavsky Beni (cben) *
Date: 2009-04-25 23:27
An interactive prompt should offer working completion out-of-the-box, without requiring every Python user on earth to create a $PYTHONSTARTUP with '''import readline; readline.parse_and_bind("tab: complete")'''.
Note that it should work not only when Python is run without arguments, but also when running with the -i option. And ideally, it should only install the completion function when dropping to the interpreter, not from the start, so that code that runs before dropping to the interpreter is not affected. But this is really not important.
Safety: if 'rlcompleter' or 'readline' are not availiable (e.g. broken python install), the user must still get a working interpreter, just without completion.
Portability: there won't be completion on windows (as long as pyreadline or similar is not part of Python). But that shouldn't delay unix support!
Author: Éric Araujo (eric.araujo) *
Date: 2009-04-27 00:38
What would be the right place for this to happen? I first thought of site.py, but -S would then turn off readline support. Does it have to be done somewhere in C land?
But perhaps tab isn’t the right key to bind. I think inputrc could set it to something different, perhaps shell rc files too. Is there an API to get this setting, does readline.so already do the right thing, or does it have to be added?
Moreover, in my PYTHONSTARTUP I not only bind tab to complete, but also set a history file. Should this be automatic too? UNIX rules would suggest a standard ~/.pyhistory file, or we could follow newer freedesktop.org specifications [1].
So, I don’t know the history and choices behind readline.so, but from a user point of view, being fed up with lack of tab completion finally had me put up a PYTHONSTARTUP file with these settings, and then some useful functions, and so on. This lack of completion was ultimately a good thing for me. Still, completion could be made to work out of the box, and the man page could link to the doc explaining how to customize this behavior.
[1] XDG Base Directory Specification: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Cheers, Merwok
Author: Antoine Pitrou (pitrou) *
Date: 2009-04-27 12:48
He, adding completion is also something I find myself adding on every box on which I use Python...
Author: R. David Murray (r.david.murray) *
Date: 2010-12-09 20:49
for what it is worth, I am +1 on having completion and history file work by default. The sqlite3 command line does this, for example. I think it is what unix user expect nowadays, and I think it is reasonable.
Looking at my home directory, it would appear that the de-facto standard history file name would be .python_history. This is based on .mysql_history, .psql_history, and .sqlite_history, none of which I configured explicitly to support history saving.
Author: Éric Araujo (eric.araujo) *
Date: 2010-12-09 20:54
Okay, that’s one question answered. Still to solve: How to bind the right key? (“But perhaps tab isn’t the right key to bind. I think inputrc could set it to something different, perhaps shell rc files too. Is there an API to get this setting, does readline.so already do the right thing, or does it have to be added?”)
Author: Antoine Pitrou (pitrou) *
Date: 2010-12-09 20:58
I think TAB is the key expected by most people, so let's make it the default. As for the location, site.py is an adequate one IMO.
Author: Ned Deily (ned.deily) *
Date: 2010-12-09 21:48
Keep in mind that the Python readline module may be linked to either GNU readline or the BSD editline (libedit) library and they have different command strings. Note the warning here:
http://docs.python.org/dev/py3k/library/readline.html
Here's a snippet of what I have today in my startup file:
import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
See Issue10666 for more details and some possible changes.
Author: Ned Deily (ned.deily) *
Date: 2010-12-09 22:30
Nosying Martin: any Windows installer concerns?
Author: Martin v. Löwis (loewis) *
Date: 2010-12-09 23:12
There is no readline support on Windows at all, so I don't think the Windows installer can be affected. I'm uncertain what the proposed change to Python is at this point, though.
Author: Éric Araujo (eric.araujo) *
Date: 2011-03-25 17:08
Ned, does readline.read_init_file() with libedit?
Author: Ned Deily (ned.deily) *
Date: 2011-03-25 17:39
readline.read_init_file() does work with libedit. The directives read have to be in libedit format.
Author: Éric Araujo (eric.araujo) *
Date: 2011-03-25 21:28
Please ignore the generated patches, left here for Martin’s benefit, and review the manually attached fix-5845.diff.
I have used read_init_file instead of hard-coding tab (it’s anyway the default for readline).
I may have repeated the same info in too much doc files, but I preferred to have more than one place where people could learn about the new behavior. Advice welcomed.
If the basic approach looks good, especially if site still feels the right place for this, I will add tests.
Author: Éric Araujo (eric.araujo) *
Date: 2011-08-18 17:05
Updated patch (not using Mercurial, looks like I haven’t enough bandwidth to push all those changesets).
Author: Antoine Pitrou (pitrou) *
Date: 2011-08-18 18:32
Updated patch (not using Mercurial, looks like I haven’t enough bandwidth to push all those changesets).
I think there's a bug in the way you are detecting interactive mode:
$ ./python -c "import sys; print(sys.stdin.isatty())" True
Author: Antoine Pitrou (pitrou) *
Date: 2011-08-18 18:37
Interestingly, there's already the following code in Modules/main.c:
if ((Py_InspectFlag || (command == NULL && filename == NULL && module == NULL)) &&
isatty(fileno(stdin))) {
PyObject *v;
v = PyImport_ImportModule("readline");
if (v == NULL)
PyErr_Clear();
else
Py_DECREF(v);
}
...meaning readline already gets imported automatically when desired. And indeed:
$ ./python -S Python 3.3.0a0 (default:50f1922bc1d5, Aug 18 2011, 00:09:47) [GCC 4.5.2] on linux2
import sys sys.modules['readline'] <module 'readline' from '/home/antoine/cpython/default/build/lib.linux-x86_64-3.3-pydebug/readline.cpython-33dm.so'>
So perhaps we could simply change this code to import another, private module (e.g. "_setupinteractive.py") which would setup readline and rlcompleter?
Author: Éric Araujo (eric.araujo) *
Date: 2011-09-05 16:30
We can’t just decide to enable completion by checking “'readline' in sys.modules” in site, because it always returns False. site is imported in Python/pythonrun.c, and I guess that Modules/main.c is run afterwards. More importantly, I think the import of readline in Modules/main.c is a CPython implementation detail, and I’d prefer to have code in site that is directly useful for other VMs. (I’d go as far as proposing to remove the import readline from main.c, when my patch makes it obsolete.)
I re-read the docs for sys.argv and the -m switch and decided to translate to C checks (“command == NULL && filename == NULL && module == NULL”) to “if not sys.argv[0]”. Unfortunately, sys.argv is not available when site is imported, so this is a dead end :(
So, I could try your _setupinteractive module idea, even though I think it’s a bit unclean, or drink the cool aid and set up completion in main.c.
Author: Cherniavsky Beni (cben) *
Date: 2011-09-05 18:29
Easily detecting interactive mode is of general interest for customization.
What if C also set sys.flags.interactive in "python" mode, or exposed sys.flags.implicit_interactive (but with better name)?
It's more useful to have a hook called when entering interactive mode, rather than a flag that's set from the beginning:
$ python -i -c 'import sys; print sys.flags.interactive' 1
For this, importing _setupinteractive is a step forward; calling e.g. sys.interactivehook sounds even better. (site.py would set it by default to a function that enables rlcompleter, user can always override...)
BTW, drawback of doing any such setup in site.py: "python -S" would be unfriendly!
Author: Éric Araujo (eric.araujo) *
Date: 2011-09-06 14:51
Easily detecting interactive mode is of general interest for customization. Thanks for the feedback. We could open a feature request for that, and/or ask python-ideas.
What if C also set sys.flags.interactive in "python" mode, or exposed sys.flags.implicit_interactive (but with better name)? An attribute in the sys module sounds like a good idea. It would not be an attribute of sys.flags though, as those are strictly command-line arguments.
It's more useful to have a hook called when entering interactive mode, rather than a flag that's set from the beginning: We already have such a hook: $PYTHONSTARTUP
calling e.g. sys.interactivehook sounds even better. That’s another interesting idea.
BTW, drawback of doing any such setup in site.py: "python -S" would be unfriendly! People using -S don’t want the customizations done in site, so I don’t think there’s a problem here.
Author: Antoine Pitrou (pitrou) *
Date: 2011-09-06 14:54
It's more useful to have a hook called when entering interactive mode, rather than a flag that's set from the beginning: We already have such a hook: $PYTHONSTARTUP
$PYTHONSTARTUP doesn't work with -i
Author: Cherniavsky Beni (cben) *
Date: 2011-09-06 16:05
[sorry, html mail was bad idea]
On Tue, Sep 6, 2011 at 17:54, Antoine Pitrou <report@bugs.python.org> wrote:
Éric Araujo <merwok@netwok.org> added the comment:
It's more useful to have a hook called when entering interactive mode, rather than a flag that's set from the beginning: We already have such a hook: $PYTHONSTARTUP
Good point! It covers the user's desire customization very well (esp. if it worked with -i). sys.interactivehook has the benefit of being cleanly settable from python code. But it might well be a YAGNI idea.
$PYTHONSTARTUP doesn't work with -i
Perhaps it should? I can't think of a thing that makes sense in $PYTHONSTARTUP that I wouldn't want with -i. (and if there is one, one can add a test for sys.flags.interactive, or run with env PYTHONSTARTUP='')
Point to watch out for: errors in $PYTHONSTARTUP. One of the uses of "python -i script.py" is doing pdb.pm() on an exception thrown by the script; ideally a broken $PYTHONSTARTUP would not overr
BTW, drawback of doing any such setup in site.py: "python -S" would be unfriendly! People using -S don’t want the customizations done in site, so I don’t think there’s a problem here.
python -S doesn't disable readline. What makes completions more of a "customization" than editing? The fact that it'd be implemented in site.py? Yes, obviously, if it's implemented in site.py, -S should disable it. My point was that it doesn't have to be implemented there. You could drink the cool aid instead :-)
Author: Éric Araujo (eric.araujo) *
Date: 2011-09-06 16:14
sys.interactivehook has the benefit of being cleanly settable from python code. But it might well be a YAGNI idea. I’ll ask python-dev about that. For the moment, I prefer the idea of a new sys.interactive attribute (boolean).
$PYTHONSTARTUP doesn't work with -i Perhaps it should? -i means two things: interactive and inspect. The second meaning is used when you want python to execute a script or module just as usual but without exiting afterward, to let you inspect the state of the program. Supporting PYTHONSTARTUP would change these use cases and be an unacceptable change.
BTW, drawback of doing any such setup in site.py: "python -S" would be unfriendly! People using -S don’t want the customizations done in site, so I don’t think there’s a problem here.
python -S doesn't disable readline. What makes completions more of a "customization" than editing? The fact that it'd be implemented in site.py? If you go back to the first messages of this report, you’ll see that I wasn’t sure what a good location would be, and decided site because it did not look out of place. There isn’t a stronger rationale than that. One could argue that even now, site mixes disparate functionality: one program could wish to use -S to disable sys.path munging but run into bugs because the builtin exit is not defined anymore for example.
Yes, obviously, if it's implemented in site.py, -S should disable it. We agree.
My point was that it doesn't have to be implemented there. I really want to explore all options before renouncing to implement it in site. I’d like the implementation to be maintainable and shareable with other Python VMs.
Author: Éric Araujo (eric.araujo) *
Date: 2011-09-13 12:39
FTR, I tried checking sys.ps1 instead of argv but it’s the same problem.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-01 20:31
In the spirit of pushing this forward, here is an updated patch using the sys.interactivehook approach. I didn't add any tests since it doesn't seem very easy to write any.
If nobody objects, I would like to commit this soon.
Author: Roundup Robot (python-dev)
Date: 2013-05-04 18:08
New changeset d5ef330bac50 by Antoine Pitrou in branch 'default': Issue #5845: Enable tab-completion in the interactive interpreter by default, thanks to a new sys.interactivehook. http://hg.python.org/cpython/rev/d5ef330bac50
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-04 18:11
End-users will hopefully rejoice :)
Author: Mark Dickinson (mark.dickinson) *
Date: 2013-05-06 11:06
On OS X 10.6, I now get the following message at interpreter startup:
iwasawa:cpython mdickinson$ ./python.exe Python 3.4.0a0 (default:d5ef330bac50, May 6 2013, 13:05:57) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. Failed calling sys.interactivehook Traceback (most recent call last): File "/Users/mdickinson/Python/cpython/Lib/site.py", line 481, in register_readline readline.read_init_file() OSError: [Errno -1] Unknown error: -1
Author: Mark Dickinson (mark.dickinson) *
Date: 2013-05-06 11:21
More information: readline.read_init_file() produced the same traceback before this commit, so all that's changed is that we're now calling this at interpreter startup. It looks like I'm using the system libedit:
iwasawa:cpython mdickinson$ otool -L build/lib.macosx-10.6-x86_64-3.4-pydebug/readline.so build/lib.macosx-10.6-x86_64-3.4-pydebug/readline.so: /usr/lib/libedit.2.dylib (compatibility version 2.0.0, current version 2.11.0) /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) iwasawa:cpython mdickinson$
Author: Mark Dickinson (mark.dickinson) *
Date: 2013-05-06 12:20
So I'm failing to find any documentation for libedit, but it looks as though this error occurs if rl_read_init_file fails to find an .editrc file in the appropriate place. If I create an empty .editrc file in my home directory, the error disappears. (Having an .inputrc file doesn't seem to make a difference either way.)
Perhaps the solution is to ignore an OSError from readline.read_init_file in register_readline---i.e., add a try / except OSError there. The other option would be to ignore a nonzero errno from rl_read_init_file, but that doesn't sound so good: I'd expect someone deliberately calling readline.read_init_file to get an exception if the initialization file isn't found.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 12:27
So I'm failing to find any documentation for libedit, but it looks as though this error occurs if rl_read_init_file fails to find an .editrc file in the appropriate place. If I create an empty .editrc file in my home directory, the error disappears. (Having an .inputrc file doesn't seem to make a difference either way.)
Perhaps the solution is to ignore an OSError from readline.read_init_file in register_readline---i.e., add a try / except OSError there.
This sounds fine to me. Can you propose a patch? I'm unlikely to ever have an OS X machine.
Author: Mark Dickinson (mark.dickinson) *
Date: 2013-05-06 12:34
The attached fixes the issue for me. I'm not sure whether the try / except should only be done on Apple, though. What's the behaviour on Linux if there's no .inputrc file?
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 12:42
The attached fixes the issue for me. I'm not sure whether the try / except should only be done on Apple, though. What's the behaviour on Linux if there's no .inputrc file?
Everything works fine under Linux (as usual :-)). There's no need to restrict the try / except to Apple platforms, though.
Author: Steven D'Aprano (steven.daprano) *
Date: 2013-05-06 12:46
I'm not able to test the patch at the moment, but since it essentially just uses the recipe in the docs, I expect it will have the same side-effect. Namely, it prevents you using the tab key to indent in the interactive interpreter.
Now I don't know if I'm missing something painfully obvious, but having to bang out space-space-space-space for every indent is surely not going to be a win for usability ;-) Even if I am missing something, surely so will a lot of other users.
I use a readline completer that (in my opinion) does the Right Thing: at the start of the line, hitting TAB inserts a tab, otherwise it does completion. It also sets a history file, adds a couple of key bindings that I sometimes find useful, and wraps it all up in a class. (Attached.) If you think there is any value in this, I'm happy to update it to Python 3.3 and polish it up as a patch to the readline module. Or someone can just mine it for ideas.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 13:24
Now I don't know if I'm missing something painfully obvious, but having to bang out space-space-space-space for every indent is surely not going to be a win for usability ;-) Even if I am missing something, surely so will a lot of other users.
What looks painfully obvious to me is that Python doesn't force you to use 4 spaces (or tabs) for indents :-)
I use a readline completer that (in my opinion) does the Right Thing: at the start of the line, hitting TAB inserts a tab, otherwise it does completion. It also sets a history file, adds a couple of key bindings that I sometimes find useful, and wraps it all up in a class.
The "indent at beginning of line" thing sounds useful. The rest seems to conflate the concept of a completer with the readline module itself. Even though it's called rlcompleter, the rlcompleter module is actually generic and could be used with other input schemes, so I don't think it's the right place to set history options or key bindings.
In any case, you should post your patch as part of a separate issue, IMO.
Author: Roundup Robot (python-dev)
Date: 2013-05-06 13:39
New changeset 82e92da929eb by Mark Dickinson in branch 'default': Issue #5845: avoid an exception at startup on OS X if no .editrc file exists. http://hg.python.org/cpython/rev/82e92da929eb
Author: Mark Dickinson (mark.dickinson) *
Date: 2013-05-06 13:40
Applied the OS X fix; reclosing.
Author: R. David Murray (r.david.murray) *
Date: 2013-05-06 13:44
The tab-doesn't-indent still needs to be fixed before 3.4 is released.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 14:06
The tab-doesn't-indent still needs to be fixed before 3.4 is released.
I don't really understand why this would be a release blocker? The interpreter prompt is a convenience, we don't guarantee compatibility like with stdlib APIs.
Author: R. David Murray (r.david.murray) *
Date: 2013-05-06 14:14
It is a release blocker because it is a major usability regression.
Author: R. David Murray (r.david.murray) *
Date: 2013-05-06 14:17
Just to be clear how important I consider this, I would advocate for backing out this patch rather than releasing 3.4 with a broken tab key at the interactive prompt. But I'd rather have the patch and a working tab key.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 14:40
It is a release blocker because it is a major usability regression.
Really? You can press the space key to indent, it works as well as the tab key...
Author: R. David Murray (r.david.murray) *
Date: 2013-05-06 14:44
Well, post it to python-dev and see what reaction you get :)
I could be wrong, but I don't think I am (obviously).
Author: Ronald Oussoren (ronaldoussoren) *
Date: 2013-05-06 14:45
I expect that a lot of users use the tab key to indent in the repl (as well as in editors, smart enough editors can convert the tab presses to spaces)
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 14:52
Well, post it to python-dev and see what reaction you get :)
I'm not interested in python-dev reactions here. For this kind of issue, we'll have hundreds of messages for and against the change without any useful content.
The commit adds an often-requested feature (to the point that many people were already taking the pain of activating it manually). But, yes, we could add Steven's refinement so that all bases are covered.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 14:57
I expect that a lot of users use the tab key to indent in the repl (as well as in editors, smart enough editors can convert the tab presses to spaces)
The interpreter prompt is not a text editor at all. You can misuse it as one, but that's a loss of time and energy IMO.
Really, everyone I've ever showed tab-completion to has always been enthusiastic about it ("why isn't this enabled by default?"). None has ever raised the concern of being able to use the tab key to indent code under the prompt.
(probably because noone is crazy enough to type long chunks of code under the interactive prompt anyway)
Author: Alexander Belopolsky (belopolsky) *
Date: 2013-05-06 15:34
I am in AP's camp on the tab issue, but I think we can preserve "tab inserts tab" behavior at the continuation prompt. I don't like "indent at beginning of line." I have rlcompleter enabled in Python 2.6 and i get the following when I press tab:
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
Display all 173 possibilities? (y or n) y ArithmeticError( abs( input( AssertionError( all( int( AttributeError( and intern( BaseException( any( is ..
I find this rather useful.
At the ... prompt, however, a tab (or better four spaces) is arguably the right completion at the beginning of the line.
Author: Antoine Pitrou (pitrou) *
Date: 2013-05-06 20:36
Take it with a large grain of Internet salt, but Ezio pointed me to the following reactions: http://www.reddit.com/r/Python/comments/1dq7sh/python_repl_finally_gets_tab_completion_by_default/
Author: Tshepang Lekhonkhobe (tshepang) *
Date: 2013-05-06 20:55
Also made it to the front-page of Hacker News[1], with better quality comments than the reddit thread.
[1] https://news.ycombinator.com/item?id=5658062
Author: Larry Hastings (larry) *
Date: 2013-07-31 07:14
This issue seems to have stalled. But it's still marked as a release blocker, which means I can't release Python 3.4a1 in two days if this issue is still open.
One of three things will happen:
- This issue is marked "closed".
- This issue is downgraded from "release blocker".
- The alpha slips.
IMO the optimal solution is that tab preceded by only whitespace indents, and tab preceded by any non-whitespace character attempts to complete. Can we goad readline into behaving this way?
Author: Steven D'Aprano (steven.daprano) *
Date: 2013-07-31 08:04
On 31/07/13 17:14, Larry Hastings wrote:
IMO the optimal solution is that tab preceded by only whitespace indents, and tab preceded by any non-whitespace character attempts to complete. Can we goad readline into behaving this way?
Yes we can. Attached are a pair of lightweight modules I've used for this for the last 3-4 years, and it works fine in Python 2.4 through 3.3. I put something like this in my startup.py:
import completer import history history = history.History() completer = completer.Completer( bindings=(r'"\C-xo": overwrite-mode', r'"\C-xd": dump-functions', ))
Originally they were in a single class, but I was persuaded that it was cleaner to separate them.
Author: Martin v. Löwis (loewis) *
Date: 2013-07-31 18:03
If R. David agrees (assuming no patch is coming forward), it could be degrated to deferred-blocker, and the alpha phases could be used to see how annoyed people are with "tab not working".
Author: R. David Murray (r.david.murray) *
Date: 2013-07-31 19:42
Yeah, deferred blocker is fine with me.
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2013-08-04 21:15
Do you know that the readline module first force rebind of TAB to insert-tab?
Author: Xavier de Gaye (xdegaye) *
Date: 2013-09-29 19:41
There is a backward compatibility issue with changeset d5ef330bac50 that enables tab-completion in the interactive interpreter by default.
When a user is not aware of this new feature and has been implementing up to now her/his PYTHONSTARTUP file with the first example given in python 3.3 documentation at
http://docs.python.org/3/library/readline.html?highlight=readline#example
then each new interactive python 3.4 session reads (appending them) both history files which are saved on exit. Thus those files double their size after each interactive python 3.4 session and pretty soon become few mega bytes long with a python start up time that becomes quite noticeable.
Author: Antoine Pitrou (pitrou) *
Date: 2013-09-29 20:00
When a user is not aware of this new feature and has been implementing up to now her/his PYTHONSTARTUP file with the first example given in python 3.3 documentation at
http://docs.python.org/3/library/readline.html?highlight=readline#example
then each new interactive python 3.4 session reads (appending them) both history files which are saved on exit. Thus those files double their size after each interactive python 3.4 session and pretty soon become few mega bytes long with a python start up time that becomes quite noticeable.
Interesting. A way to avoid doing this would be to only load history if no history is already present. Since the sys.interactivehook is executed after PYTHONSTARTUP, this would allow the latter to take precedence.
Author: Antoine Pitrou (pitrou) *
Date: 2013-09-29 20:06
Attaching patch to only load history file if no history exists.
Author: Roundup Robot (python-dev)
Date: 2013-09-29 20:19
New changeset 687dd81cee3b by Antoine Pitrou in branch 'default': Issue #5845: In site.py, only load readline history from ~/.python_history if no history has been read already. This avoids double writes to the history file at shutdown. http://hg.python.org/cpython/rev/687dd81cee3b
Author: Xavier de Gaye (xdegaye) *
Date: 2013-09-29 20:43
The patch fixes the problem on my setup. A very minor glitch: after manually emptying or removing the PYTHONSTARTUP history file, the history is loaded with the content of ~/.python_history on the next session.
Author: Antoine Pitrou (pitrou) *
Date: 2013-09-29 21:13
The patch fixes the problem on my setup. A very minor glitch: after manually emptying or removing the PYTHONSTARTUP history file, the history is loaded with the content of ~/.python_history on the next session.
Yes, the only way to know if a history file has already been loaded with readline seems to be to query the history itself. So, if the history is empty, we consider no file has been loaded.
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2013-12-08 15:02
What is the status of this issue?
Author: Antoine Pitrou (pitrou) *
Date: 2013-12-08 19:18
I would say it's now closed. If there's some fine tuning needed, separate issues should be opened.
Author: Jason R. Coombs (jaraco) *
Date: 2014-01-27 20:13
Added , revealed in 3.4b2.
Author: Roundup Robot (python-dev)
Date: 2014-03-09 19:17
New changeset 69c451851c71 by R David Murray in branch 'default': whatsnew: sys.interactivehook. (#5845) http://hg.python.org/cpython/rev/69c451851c71
Author: David Beazley (dabeaz)
Date: 2014-04-09 00:17
Funny thing, this feature breaks the interactive interpreter in the most basic way on OS X systems. For example, the tab key won't even work to indent. You can't even type the most basic programs into the interactive interpreter. For example:
for i in range(10): ... print(i)
Oh sure, you can make it work by typing the space bar a bunch of times, but it's extremely annoying.
The only way I was able to get a working interactive interpreter on my machine was to manually edit site.py and remove the call to enablerlcompleter() from main().
I hope someone reconsiders this feature and removes it as default behavior.
Author: R. David Murray (r.david.murray) *
Date: 2014-04-12 16:09
This issue should have gone back to being a release blocker after the alpha release to fix the tab-as-indent issue, but obviously that didn't happen (I forgot about it myself). Please open a new issue requesting a fix for this bug (that tab doesn't work as indent at the ... prompt), referencing the discussion in this issue.
Author: Victor Varvariuc (Victor.Varvariuc)
Date: 2015-06-13 19:42
Here is the new issue (putting the link here for reference): http://bugs.python.org/issue22086
Author: R. David Murray (r.david.murray) *
Date: 2015-06-13 20:09
The active issue for this is now 23441.
History
Date
User
Action
Args
2022-04-11 14:56:48
admin
set
github: 50095
2015-06-13 20:09:00
r.david.murray
set
messages: +
2015-06-13 19:42:50
Victor.Varvariuc
set
nosy: + Victor.Varvariuc
messages: +
2014-04-12 16:09:43
r.david.murray
set
messages: +
2014-04-09 00:17:44
dabeaz
set
nosy: + dabeaz
messages: +
2014-03-09 19:17:41
python-dev
set
messages: +
2014-01-27 20:13:40
jaraco
set
nosy: + jaraco
messages: +
2013-12-08 19🔞07
pitrou
set
status: open -> closed
messages: +
2013-12-08 15:02:34
serhiy.storchaka
set
messages: +
2013-09-29 21:13:22
pitrou
set
messages: +
2013-09-29 20:43:44
xdegaye
set
messages: +
2013-09-29 20:19:15
python-dev
set
messages: +
2013-09-29 20:06:57
pitrou
set
keywords: - needs review
resolution: fixed
messages: +
files: + rl_history_guard.patch
2013-09-29 20:00:50
pitrou
set
messages: +
2013-09-29 19:41:03
xdegaye
set
nosy: + xdegaye
messages: +
2013-08-04 21:15:42
serhiy.storchaka
set
messages: +
2013-07-31 19:42:20
r.david.murray
set
priority: release blocker -> deferred blocker
messages: +
2013-07-31 18:03:41
loewis
set
messages: +
2013-07-31 08:04:14
steven.daprano
set
files: + completer.py, history.py
messages: +
2013-07-31 07:14:13
larry
set
messages: +
2013-06-26 10:36:36
techtonik
set
nosy: + techtonik
2013-05-06 20:55:20
tshepang
set
messages: +
2013-05-06 20:36:36
pitrou
set
messages: +
2013-05-06 15:34:45
belopolsky
set
messages: +
2013-05-06 14:57:07
pitrou
set
messages: +
2013-05-06 14:52:07
pitrou
set
messages: +
2013-05-06 14:45:27
ronaldoussoren
set
messages: +
2013-05-06 14:44:02
r.david.murray
set
messages: +
2013-05-06 14:40:06
pitrou
set
messages: +
2013-05-06 14:17:58
r.david.murray
set
messages: +
2013-05-06 14:14:42
r.david.murray
set
messages: +
2013-05-06 14:06:52
pitrou
set
messages: +
2013-05-06 13:44:31
r.david.murray
set
status: closed -> open
priority: normal -> release blocker
nosy: + larry
messages: +
resolution: fixed -> (no value)
2013-05-06 13:40:47
mark.dickinson
set
status: open -> closed
resolution: fixed
messages: +
2013-05-06 13:39:47
python-dev
set
messages: +
2013-05-06 13:24:02
pitrou
set
messages: +
2013-05-06 12:46:53
steven.daprano
set
files: + completer.py
messages: +
2013-05-06 12:42:32
pitrou
set
messages: +
2013-05-06 12:34:14
mark.dickinson
set
files: + issue5845_osx_fix.patch
messages: +
2013-05-06 12:27:25
pitrou
set
messages: +
2013-05-06 12:20:34
mark.dickinson
set
status: closed -> open
resolution: fixed -> (no value)
messages: +
2013-05-06 11:21:21
mark.dickinson
set
messages: +
2013-05-06 11:06:12
mark.dickinson
set
nosy: + mark.dickinson
messages: +
2013-05-04 18:11:40
pitrou
set
status: open -> closed
resolution: fixed
messages: +
stage: patch review -> resolved
2013-05-04 18:08:43
python-dev
set
nosy: + python-dev
messages: +
2013-05-02 07:37:39
serhiy.storchaka
set
nosy: + serhiy.storchaka
2013-05-01 20:31:41
pitrou
set
files: + defaultreadline.patch
messages: +
2013-05-01 19:35:41
pitrou
set
files: + c43e264256e4.diff
2013-03-21 23:51:05
tshepang
set
versions: + Python 3.4, - Python 3.3
2013-03-21 23:49:41
tshepang
set
nosy: + tshepang
2013-03-21 12:23:54
flox
set
nosy: + flox
2013-03-21 09:58:20
giampaolo.rodola
set
nosy: + giampaolo.rodola
2012-10-05 15:43:57
steven.daprano
set
nosy: + steven.daprano
2011-09-13 12:39:18
eric.araujo
set
messages: +
2011-09-08 10:20:25
ezio.melotti
set
nosy: + ezio.melotti
2011-09-06 16:14:42
eric.araujo
set
messages: +
2011-09-06 16:06:06
eric.araujo
set
messages: -
2011-09-06 16:05:46
eric.araujo
set
files: - unnamed
2011-09-06 16:05:05
cben
set
messages: +
2011-09-06 15:54:26
cben
set
files: + unnamed
messages: +
2011-09-06 14:54:39
pitrou
set
messages: +
2011-09-06 14:51:23
eric.araujo
set
messages: +
2011-09-05 18:29:38
cben
set
messages: +
2011-09-05 16:30:44
eric.araujo
set
messages: +
2011-08-18 18:37:53
pitrou
set
messages: +
2011-08-18 18:32:07
pitrou
set
messages: +
2011-08-18 17:05:24
eric.araujo
set
files: + fix-5845.diff
messages: +
2011-08-18 17:04:40
eric.araujo
set
files: - fix-5845.diff
2011-03-25 23:25:04
eric.araujo
set
files: - d1cbf0347eb4.diff
2011-03-25 23:25:01
eric.araujo
set
files: - c43e264256e4.diff
2011-03-25 23:24:56
eric.araujo
set
files: - a5bded1b8db4.diff
2011-03-25 23🔞48
eric.araujo
set
files: + d1cbf0347eb4.diff
2011-03-25 22:21:16
loewis
set
files: + c43e264256e4.diff
2011-03-25 22:15:42
loewis
set
files: - c43e264256e4.diff
2011-03-25 21:28:17
eric.araujo
set
keywords: + needs review
files: + fix-5845.diff
messages: +
stage: patch review
2011-03-25 21:16:17
eric.araujo
set
files: + c43e264256e4.diff
2011-03-25 21:15:09
eric.araujo
set
files: + a5bded1b8db4.diff
keywords: + patch
2011-03-25 20:26:05
eric.araujo
set
hgrepos: + hgrepo9
2011-03-25 17:39:41
ned.deily
set
messages: +
2011-03-25 17:08:32
eric.araujo
set
messages: +
versions: - Python 3.2
2010-12-09 23:12:51
loewis
set
messages: +
2010-12-09 22:30:22
ned.deily
set
nosy: + loewis
messages: +
2010-12-09 21:48:17
ned.deily
set
messages: -
2010-12-09 21:48:10
ned.deily
set
messages: +
2010-12-09 21:47:21
ned.deily
set
nosy: + ronaldoussoren, ned.deily
messages: +
2010-12-09 20:58:58
pitrou
set
nosy:cben, belopolsky, pitrou, eric.araujo, r.david.murray, lesmana
messages: +
components: + Library (Lib), - Interpreter Core
versions: + Python 3.2
2010-12-09 20:54:53
eric.araujo
set
messages: +
versions: + Python 3.3, - Python 3.1, Python 2.7
2010-12-09 20:49:07
r.david.murray
set
nosy: + r.david.murray
messages: +
2010-06-12 01:45:23
belopolsky
set
nosy: + belopolsky
2010-06-06 15:32:04
lesmana
set
nosy: + lesmana
2009-04-27 12:48:49
pitrou
set
nosy: + pitrou
messages: +
2009-04-27 00:38:22
eric.araujo
set
nosy: + eric.araujo
messages: +
2009-04-25 23:28:27
cben
set
type: enhancement
components: + Interpreter Core
versions: + Python 3.1, Python 2.7
2009-04-25 23:27:18
cben
create