Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PyREPL crashes when there aren't enough columns #127349

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixesstdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error
@trag1c

Description

@trag1c

Bug report

Bug description:

To reproduce

(order doesn't matter)

  • Open the new REPL
  • Resize the terminal emulator window to be less than 5 cells wide

Traceback

Traceback (most recent call last):  File "<frozen runpy>", line 198, in _run_module_as_main  File "<frozen runpy>", line 88, in _run_code  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/__main__.py", line 6, in <module>    __pyrepl_interactive_console()    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/main.py", line 59, in interactive_console    run_multiline_interactive_console(console)    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/simple_interact.py", line 151, in run_multiline_interactive_console    statement = multiline_input(more_lines, ps1, ps2)  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/readline.py", line 389, in multiline_input    return reader.readline()           ~~~~~~~~~~~~~~~^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/reader.py", line 801, in readline    self.handle1()    ~~~~~~~~~~~~^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/reader.py", line 770, in handle1    self.refresh()    ~~~~~~~~~~~~^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/reader.py", line 691, in refresh    self.screen = self.calc_screen()                  ~~~~~~~~~~~~~~~~^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/completing_reader.py", line 261, in calc_screen    screen = super().calc_screen()  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/reader.py", line 413, in calc_screen    self.cxy = self.pos2xy()               ~~~~~~~~~~~^^  File "/Users/trag1c/.pyenv/versions/3.13.0/lib/python3.13/_pyrepl/reader.py", line 595, in pos2xy    p, l2 = self.screeninfo[y]            ~~~~~~~~~~~~~~~^^^IndexError: list index out of range

The relevant fragment of code

defpos2xy(self)->tuple[int,int]:
"""Return the x, y coordinates of position 'pos'."""
# this *is* incomprehensible, yes.
y=0
pos=self.pos
assert0<=pos<=len(self.buffer)
ifpos==len(self.buffer):
y=len(self.screeninfo)-1
p,l2=self.screeninfo[y]
returnp+sum(l2)+l2.count(0),y

An additional demo

Screen.Recording.2024-11-27.at.11.47.29.PM.mov

CPython versions tested on:

3.13, 3.14

Operating systems tested on:

Linux, macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixesstdlibPython modules in the Lib dirtopic-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


      [8]ページ先頭

      ©2009-2025 Movatter.jp