cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Bad indentation after pasting code in interactive interpreter

Open rudyment opened this issue 1 year ago • 9 comments

Bug report

Bug description:

In the interactive interpreter it is not possible to simply insert function definitions from the clipboard, because each line of the function body is indented compared to the previous one.

If I copy the function definition:

def f(): x = 1 x = 2

to the clipboard and paste it into the interactive interpreter, I get

>>> def f(): ... x = 1 ... x = 2 File "<unknown>", line 3 x = 2 IndentationError: unexpected indent >>>

CPython versions tested on:

3.13

Operating systems tested on:

Windows

rudyment avatar Jul 05 '24 11:07 rudyment