You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Interactive shell doesn't work with readline bracketed paste #76200
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=Noneclosed_at=<Date2021-02-15.09:49:01.269>created_at=<Date2017-11-13.23:02:31.953>labels= []
title="Interactive shell doesn't work with readline bracketed paste"updated_at=<Date2021-02-15.09:49:01.267>user='https://github.com/asmeurer'
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=1a
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.
Activity
asmeurer commentedon Nov 13, 2017
Here are the steps to reproduce this:
set enable-bracketed-paste on
to your ~/.inputrc
You get something like
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 commentedon Feb 15, 2021
I mark this issue as a duplicate of bpo-39820.