[issue5845] rlcompleter should be enabled automatically

Éric Araujo report at bugs.python.org
Mon Sep 5 18:30:44 CEST 2011


Éric Araujo <merwok at netwok.org> added the comment:

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.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5845>
_______________________________________


More information about the Python-bugs-list mailing list