Closed
Description
Bug report
Bug description:
To reproduce, copy paste this into the Python REPL:
from dataclasses import dataclass
@dataclass
class Point:
x: float
y: float
You'll see:
>>> from dataclasses import dataclass
...
... @dataclass
... class Point:
... x: float
... y: float
...
>>>
Now attempt to edit that class to include z: float
(in addition to x: float
and y: float
).
To do this, hit the up arrow key to edit the previous block and you'll see:
>>> from dataclasses import dataclass
...
... @dataclass
... class Point:
... x: float
... y: float
Hitting Enter will then execute the block of code (notice that there's no blank line at the end):
>>> from dataclasses import dataclass
...
... @dataclass
... class Point:
... x: float
... y: float
>>>
If from dataclasses import dataclass
is not included in the pasted text, adding z: float
is possible (as expected).
Given that, I suspect this is a special case related to there being multiple distinct top-level blocks/statements within the pasted text.
CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Linux