Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readline.parse_and_bind fails silently on 2.7 #2072

Closed
gitlab-importer opened this issue Jun 28, 2015 · 5 comments
Closed

readline.parse_and_bind fails silently on 2.7 #2072

gitlab-importer opened this issue Jun 28, 2015 · 5 comments
Labels
bug Something isn't working

Comments

@gitlab-importer
Copy link

In Heptapod by bitbucket_importer on Jun 28, 2015, 22:37

Created originally on Bitbucket by lac

In the command interpreter type:
import readline
readline.parse_and_bind('Control-tab: "import"')

Then type control-tab on the next line. readline should insert import. PyPy 2.7.9 (2.5.1+dfsg-1, Mar 27 2015, 19:45:43) doesn't.

There is an alternative syntax.
readline.parse_and_bind(r'"\C-\t": "import"')

This doesn't work either. Note that CPython Python 2.7.9 (default, Mar 1 2015, 12:57:24)
has bugs over this also, but different ones.
readline.parse_and_bind(r'"\C-\t": "import"') in CPython does nothing.
readline.parse_and_bind('Control-tab: "import"') works
but if you then do
readline.parse_and_bind('tab: "raise"')

both tab and control-tab will be set to insert "raise" by CPython. There seems to be no way to bind control-tab and tab to different things in CPython.

This bug was discovered by Steve D'Aprano in CPython 2.7. He will probably make a CPython bug report about it soon.

@gitlab-importer
Copy link
Author

In Heptapod by @arigo on Jun 29, 2015, 08:55

See the definition of parse_and_bind() in PyPy, in lib_pypy/pyrepl/readline.py:

#!python

    def parse_and_bind(self, string):
        pass  # XXX we don't support parsing GNU-readline-style init files

It could be documented somewhere...

@gitlab-importer
Copy link
Author

In Heptapod by bitbucket_importer on Jun 29, 2015, 09:24

Created originally on Bitbucket by lac

Maybe it belongs http://pypy.readthedocs.org/en/latest/cpython_differences.html ?

Of course if Chris' new Python console, under development, turns out to be fun and good to use, we may want to revisit this decision....

@gitlab-importer
Copy link
Author

In Heptapod by bitbucket_importer on Jun 29, 2015, 09:25

Created originally on Bitbucket by lac

and if instead of just passing, maybe parse_and_bind should report that it is not doing anything.

@gitlab-importer
Copy link
Author

In Heptapod by @arigo on Jun 29, 2015, 16:08

It's not very clear, as it would annoy some people with PYTHONSTARTUP files that call it. It would start printing warnings all the time, which is sometimes worse than simply ignoring them---anyway it should be clear that our command-line is different than CPython's, if only because it supports multiline input.

Documentation added in b488a7eacab3.

@gitlab-importer
Copy link
Author

In Heptapod by bitbucket_importer on Oct 30, 2019, 18:02

Created originally on Bitbucket by mattip

Closing as an issue about missing documentation that was added. Please reopen if I misunderstood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant