Repository navigation
Python 3.14 REPL blanks links above terminal rows when pasting #135055
Copy link
Copy link
Open
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
In Python 3.14 beta 2, pasting code that has more lines than the height of my terminal window will result in the lines just above the terminal window being blank.
To reproduce:
- Resize your terminal so the height is approximately 20 rows
- Paste the below block of Python code.
- Scroll up in your terminal to see previous lines above the last 20 rows
- Note that all rows above the terminal screen are blank (no
class Point:line or__slots__line for example)
class Point:
__slots__ = ('x', 'y')
__match_args__ = ('x', 'y')
def __init__(self, x: float, y: float) -> None:
object.__setattr__(self, 'x', x)
object.__setattr__(self, 'y', y)
def __repr__(self):
cls = type(self).__name__
return f'{cls}(x={self.x!r}, y={self.y!r})'
def __eq__(self, other):
if not isinstance(other, Point):
return NotImplemented
return (self.x, self.y) == (other.x, other.y)
def __hash__(self):
return hash((self.x, self.y))
def __setattr__(self, name, value):
raise AttributeError(f"Can't set attribute {name!r}")
def __delattr__(self, name):
raise AttributeError(f"Can't delete attribute {name!r}")
def __getstate__(self):
return (self.x, self.y)
def __setstate__(self, state):
fields = ('x', 'y')
for field, value in zip(fields, state):
object.__setattr__(self, field, value)This is essentially the same as the "Blank lines" section of issue #119517.
I assume this is being done for performance reasons, but this is going to make my life harder when teaching. I often use a large font when teaching, so it's not uncommon that I'll paste a block of code that is longer than the terminal height. Being able to scroll up and show my students what was pasted is an essential feature for me when teaching.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
tomasr8 commentedon Jun 3, 2025
Bisected to fac41f5 (#133247)
treyhunner commentedon Jul 8, 2025
I just confirmed that this is still an issue in 3.14.0b4.
Another way to reproduce:
treyhunner commentedon Sep 2, 2025
This is still an issue with the 3.14rc2 and this may keep me from using 3.14 while teaching. The syntax highlighting is really great, but this regression is a pretty big issue when live-coding in the REPL.
@ambv, assuming this change in behavior was to improve performance while pasting, would not highlighting large blocks of text (or not highlighting text shown before the current terminal view) improve performance enough to allow showing the whole text block?
ambv commentedon Sep 15, 2025
IPython does what we're doing now as well. Code that is outside of the visible viewport is not emitted. We are still emitting empty lines, which is in itself a bug (it's not useful and IPython doesn't do it). I'll fix that.
The change was indeed made to make pasting faster, so I'll look into whether bulk-emitting non-highlighted code past the scrollback barrier is feasible.
chris-eibl commentedon Sep 16, 2025
Maybe emitting highlighted code past the scrollback can be done in a different paste mode like
and / or using CTRL-SHIFT-v (or whatever short cut seems more appropriate)?