Skip to content

AssertionError in __move_tall when scrolling through REPL history #131379

Closed

Description

@correctmost

Bug report

Bug description:

Steps to reproduce

  1. mv -i ~/.python_history ~/.python_history.bak
  2. echo "difflib.get_close_matches("set", ['__module__', '__qualname__', '__annotations__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__']" > ~/.python_history
  3. echo "poss = ['__module__', '__qualname__', '__annotations__', 'BAR', '_value2member_map_', '__members__', 'name', '__module__', '__qualname__', '__annotations__', '__module__', '__qualname__', '__annotations__', '__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_count', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'is_integer', 'numerator', 'real', 'to_bytes', '__module__', '__qualname__', '__annotations__', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__module__', '__qualname__', '__annotations__', '__module__', '__qualname__', '__annotations__', '__signature__', '__new__', '__init__', '_add_alias_', '_add_value_alias_', '_generate_next_value_', '_missing_', '__repr__', '__str__', '__dir__', '__format__', '__hash__', '__reduce_ex__', '__deepcopy__', '__copy__', 'name', 'value', '__module__', '__qualname__', '__annotations__', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__module__', '__qualname__', '__annotations__', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__']" >> ~/.python_history
  4. Open an 80x20 terminal window (I use xfce4-terminal)
  5. Run python
  6. Press up twice to trigger an AssertionError

Error

  File "/usr/lib/python3.13/_pyrepl/unix_console.py", line 756, in __move_tall
    assert 0 <= y - self.__offset < self.height, y - self.__offset
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: -1

Version info

Python 3.13.2 on Arch Linux

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    topic-replRelated to the interactive shell
    on Mar 17, 2025
  2. eendebakpt commented on Mar 18, 2025

    @eendebakpt
    Contributor

    I can confirm the issue on current main branch (commit f819900) using Linux. For me I need to resize the terminal to have a small width (similar to the issue report). In the assertion triggered I have y=1 self.__offset=2 self.height=17.

    With this .python_history file:

    difflib.get_close_matches(set, ['__module__', '__qualname__', '__annotations__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', 'ssssss', 'dddddddddddddd', 'ddddddddddddddd', 'dddddddddddddddddddddd', 'dddddddddddddddd', 'ssssssssssssssssssssssssssssssss', 'sssssssssssssssssssssssssssssssssssssssssssss', 'sssssssssssssssss']
    poss = ['__module__', '__qualname__', '__annotations__', 'BAR', '_value2member_map_', '__members__', 'name', '__module__', '__qualname__', '__annotations__', '__module__', '__qualname__', '__annotations__', '__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_count', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'is_integer', 'numerator', 'real', 'to_bytes', '__module__', '__qualname__', '__annotations__', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__module__', '__qualname__', '__annotations__', '__module__', '__qualname__', '__annotations__', '__signature__', '__new__', '__init__', '_add_alias_', '_add_value_alias_', '_generate_next_value_', '_missing_', '__repr__', '__str__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__module__', '__qualname__', '__annotations__', '__module__', '__qualname__', '__annotations__', '__signature__', '__new__', '__init__', '_add_alias_', '_add_value_alias_', '_generate_next_value_', '_missing_', '__repr__', '__str__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__module__', '__qualname__', '__annotations__', '__module__', '__qualname__', '__annotations__', '__signature__', '__new__', '__init__', '_add_alias_', '_add_value_alias_', '_generate_next_value_', '_missing_', '__repr__', '__str__', '__dir__', '__format__', '__hash__', '__reduce_ex__', '__deepcopy__', '__copy__', 'name', 'value', '__module__', '__qualname__', '__annotations__', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__module__', '__qualname__', '__annotations__', '__class__', '__delattr__', '__dir__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__']
    

    the same issue occurs on a standard terminal.

    @pablogsal

  3. pablogsal commented on Mar 18, 2025

    @pablogsal
    Member
  4. deepwzh commented on Mar 19, 2025

    @deepwzh
    Contributor

    I have also reproduced the issue. I submit a modification to solve this issue.

  5. added 2 commits that reference this issue on Mar 19, 2025
  6. eendebakpt commented on Jun 8, 2026

    @eendebakpt
    Contributor

    @correctmost The issue might have been fixed by #146584. Could you confirm?

  7. correctmost commented on Jun 9, 2026

    @correctmost
    Author

    @correctmost The issue might have been fixed by #146584. Could you confirm?

    I don't see the assertion failure when testing main (16ede81), so it seems fixed.

  8. added
    pendingThe issue will be closed if no feedback is provided
    on Jun 21, 2026
  9. eendebakpt commented on Jun 21, 2026

    @eendebakpt
    Contributor

    Marked the issue pending. If there are no further reports coming in, we can close the issue.

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

    pendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytopic-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