[issue43379] Pasting multiple lines in the REPL is broken since 3.9

Romain Vincent report at bugs.python.org
Tue Mar 2 16:45:36 EST 2021


New submission from Romain Vincent <romain at rwigo.com>:

DISCLAIMER: This is the first time I submit an issue here. In advance, my humble apologies if I missed something.
Feel free to correct me :)

--

I regularly test snippets of code by pasting them from a code editor to a shell REPL.

It works perfectly well in python 3.8 or 3.7 but not in python 3.9.

Demonstration:

Try to copy and paste the following simple snippet:

---

def f():
    print("hello world")

---

The result in a python 3.8 REPL (same with 3.7):

---

$ python3.8
Python 3.8.6 (default, Nov 20 2020, 18:29:40)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
    print("hello world")
>>> f()
hello world

---

But with python 3.9:

---

$ python3.9
Python 3.9.1 (default, Dec 10 2020, 10:36:35)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
    print("hello world")
  File "<stdin>", line 1

    ^
SyntaxError: multiple statements found while compiling a single statement

---

This behavior happens with any snippet of code containing at least one indented line, whether by tabs or spaces and whatever the number of spaces.


Regards.

----------
components: IO
messages: 387976
nosy: romainfv
priority: normal
severity: normal
status: open
title: Pasting multiple lines in the REPL is broken since 3.9
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43379>
_______________________________________


More information about the Python-bugs-list mailing list