GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python 3.14 REPL blanks links above terminal rows when pasting · Issue #135055 · python/cpython

Python 3.14 REPL blanks links above terminal rows when pasting #135055

New issue
Copy link
New issue
Copy link
Open
Open
Python 3.14 REPL blanks links above terminal rows when pasting#135055
Copy link
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

@treyhunner
treyhunner
opened on Jun 3, 2025
Issue body actions

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:

  1. Resize your terminal so the height is approximately 20 rows
  2. Paste the below block of Python code.
  3. Scroll up in your terminal to see previous lines above the last 20 rows
  4. 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

Activity

  1. treyhunner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 3, 2025
  2. emmatyping
    added
    topic-replRelated to the interactive shellRelated to the interactive shell
    3.14bugs and security fixesbugs and security fixes
    3.15bugs and security fixesbugs and security fixes
    on Jun 3, 2025
  3. tomasr8 commented on Jun 3, 2025

    @tomasr8
    tomasr8
    on Jun 3, 2025
    Member
    More actions

    Bisected to fac41f5 (#133247)

    Reacted by Trey Hunner
  4. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Jun 7, 2025
  5. treyhunner commented on Jul 8, 2025

    @treyhunner
    treyhunner
    on Jul 8, 2025
    MemberAuthor
    More actions

    I just confirmed that this is still an issue in 3.14.0b4.

    Another way to reproduce:

    • Resize your terminal window to have few rows
    • Paste a large multi-line string
    • Resize your terminal window to be normally sized on your machine
    • Witness the blank lines above the last few rows of pasted text
    Image
  6. treyhunner commented on Sep 2, 2025

    @treyhunner
    treyhunner
    on Sep 2, 2025
    MemberAuthor
    More actions

    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?

  7. ambv commented on Sep 15, 2025

    @ambv
    ambv
    on Sep 15, 2025
    Contributor
    More actions

    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.

    Reacted by Trey Hunner
  8. chris-eibl commented on Sep 16, 2025

    @chris-eibl
    chris-eibl
    on Sep 16, 2025
    Member
    More actions

    Maybe emitting highlighted code past the scrollback can be done in a different paste mode like

    F4: enter "full" paste mode (press again to exit)

    and / or using CTRL-SHIFT-v (or whatever short cut seems more appropriate)?

  9. StanFromIreland
    marked Pasting large blocks of code into the console causes the code to be truncated #137979 as a duplicate of this issue on May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.