Skip to content

Odd behavior from pasting large text in the new REPL #119517

Description

@treyhunner

Bug report

Bug description:

This is a description of a few bugs related to paste mode in the new REPL.

Blank lines

I tried copy-pasting the first 604 lines of this copy of Frankenstein (about 32,000 characters).

After pasting, when I scroll up in my terminal I see 1 additional line above the currently visible lines (the 61 last lines) and then I see 543 blank lines. It seems that the first 543/604 lines show up as blank and the last 61 lines do not.

>>> f = """


[539 more blank lines]


... appreciate the extraordinary merits of this wonderful man.  Sometimes I
... have endeavoured to discover what quality it is which he possesses that
[57 more lines of text]
... embraced the gallant vessel on its course and wrecked it--thus!
... """
>>>

I assume this behavior may have been for the purpose of enhancing performance.
Pasting this text only took about 1 second, which is much faster than a couple weeks ago) but still slower than the old REPL.
I have not yet attempted to reproduce the blank line issue before #119341 was merged to see if it was the cause.

Paste performance and Ctrl+C

When pasting the full 7,652 line (441,033 character) text of Frankenstein takes about 21 seconds.
That's again, considerably faster than it would have been a couple weeks ago, though it does still takes a bit of time.

The most concerning part about the slow pasting is that the terminal is entirely locked during pasting.
Hitting Ctrl+C does not stop pasting and the arrow keys don't work.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Activity

  1. pablogsal commented on Jun 4, 2024

    @pablogsal
    Member

    @treyhunner can you check if the first problem reproduces with the current main?

    Ah, yeah it reproduces. Unfortunately to fix this we would need some considerable changes to how characters are processed so I am unsure if this will get fixed before 3.13 is out.

    The problem is that to speed up pasting we are only refreshing at the end, but that doesn't input the characters in the terminal so terminal scrolling doesn't show them becase they were never written :(

    CC @ambv @lysnikolaou

  2. pablogsal commented on Jun 4, 2024

    @pablogsal
    Member

    To fix this we need to get rid of the calc_complete_screen function and replace it for something more efficient

  3. godlygeek commented on Jun 6, 2024

    @godlygeek
    Contributor

    When pasting the full 7,652 line (441,033 character) text of Frankenstein takes about 21 seconds.

    How long does it take if you export PYTHON_BASIC_REPL=1?

  4. added 2 commits that reference this issue on Jun 7, 2024
  5. added a commit that references this issue on Jun 11, 2024
  6. added a commit that references this issue on Jun 11, 2024
  7. added a commit that references this issue on Jun 30, 2024
  8. added a commit that references this issue on Jul 11, 2024
  9. added a commit that references this issue on Jul 17, 2024
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

    topic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions