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

Interactive shell doesn't work with readline bracketed paste #76200

Closed
asmeurer mannequin opened this issue Nov 13, 2017 · 2 comments
Closed

Interactive shell doesn't work with readline bracketed paste #76200

asmeurer mannequin opened this issue Nov 13, 2017 · 2 comments

Comments

@asmeurer
Copy link
Mannequin

asmeurer mannequin commented Nov 13, 2017

BPO 32019
Nosy @vstinner, @asmeurer, @tirkarthi
Superseder
  • bpo-39820: Bracketed paste mode for REPL: don't execute pasted command before ENTER is pressed explicitly
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-02-15.09:49:01.269>
    created_at = <Date 2017-11-13.23:02:31.953>
    labels = []
    title = "Interactive shell doesn't work with readline bracketed paste"
    updated_at = <Date 2021-02-15.09:49:01.267>
    user = 'https://github.com/asmeurer'

    bugs.python.org fields:

    activity = <Date 2021-02-15.09:49:01.267>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-02-15.09:49:01.269>
    closer = 'vstinner'
    components = []
    creation = <Date 2017-11-13.23:02:31.953>
    creator = 'Aaron.Meurer'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32019
    keywords = []
    message_count = 2.0
    messages = ['306176', '386990']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'Aaron.Meurer', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '39820'
    type = None
    url = 'https://bugs.python.org/issue32019'
    versions = []

    @asmeurer
    Copy link
    Mannequin Author

    asmeurer mannequin commented Nov 13, 2017

    Here are the steps to reproduce this:

    • Compile and link Python against readline version 7.0 or higher.
    • Add

    set enable-bracketed-paste on

    to your ~/.inputrc

    • Start python and paste the following two lines. Make sure to use a terminal emulator that supports bracketed paste (most modern ones do). You'll need to type enter after pasting the lines.
    a = 1
    a

    You get something like

    >>> a = 1
    a
      File "<stdin>", line 1
        a
    ^
    

    SyntaxError: multiple statements found while compiling a single statement

    It does work, however, if you paste something that has a newline but is a single statement, like

    (1,
    2)

    Fixing this in the right way might not be so easy, due to the way that compile('single') is over-engineered. A simple fix would be to disable bracketed paste in the Python shell.

    I tested this with Python 3.6.3. I was not able to get the git master to compile, so I couldn't test it there.

    @vstinner
    Copy link
    Member

    I mark this issue as a duplicate of bpo-39820.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant