Skip to content

AssertionError occurs using 3.130b1 interactive mode when pressed tab and up arrow#118877

@BreezeWhite

Description

@BreezeWhite

Bug report

Bug description:

Hi dear core developers,

I was playing with the newest REPL v3.130b1 on my M2 MacBook Pro with macOS 14.3. I built the python binary from the source at commit b62cb5234b. It's really impressive and exciting to see how much the standard REPL has evolved in this version.

However the bug occurred while I was playing with the auto-completion on the command. Says I want to see what operations are there under datetime module, type datetime. and press Tab twice, the suggestions show up correctly. But when I try to surf the suggestions with arrow keys pressed several times, I got the AssertionError:

Python3.13.0b1+ (heads/3.13:b62cb5234b, May102024, 10:17:59) [Clang15.0.0 (clang-1500.1.0.2.5)] ondarwinType"help", "copyright", "credits"or"license"formoreinformation. >>>importdatetimedatetime.MAXYEARdatetime.date( datetime.time( datetime.tzinfo( datetime.MINYEARdatetime.datetime( datetime.timedelta( Traceback (mostrecentcalllast):atetime_CAPIdatetime.timezone( File"<frozen runpy>", line198, in_run_module_as_mainFile"<frozen runpy>", line88, in_run_codeFile"/Users/thmac-02/cpython/Lib/_pyrepl/__main__.py", line47, in<module>interactive_console() ~~~~~~~~~~~~~~~~~~~^^File"/Users/thmac-02/cpython/Lib/_pyrepl/__main__.py", line44, ininteractive_consolereturnrun_interactive(mainmodule) File"/Users/thmac-02/cpython/Lib/_pyrepl/simple_interact.py", line138, inrun_multiline_interactive_consolestatement, contains_pasted_code=multiline_input(more_lines, ps1, ps2) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^File"/Users/thmac-02/cpython/Lib/_pyrepl/readline.py", line301, inmultiline_inputreturnreader.readline(), reader.was_paste_mode_activated~~~~~~~~~~~~~~~^^File"/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line652, inreadlineself.handle1() ~~~~~~~~~~~~^^File"/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line635, inhandle1self.do_cmd(cmd) ~~~~~~~~~~~^^^^^File"/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line589, indo_cmdself.update_cursor() ~~~~~~~~~~~~~~~~~~^^File"/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line499, inupdate_cursorself.cxy=self.pos2xy() ~~~~~~~~~~~^^File"/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line471, inpos2xyassert0<=pos<=len(self.buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError

Not sure if this is the intended behavior of using the new REPL, but I still hope this could be solved as this can largely improve the user experience of using the new auto-completion feature.

Thanks for all your hard works, the new python features are really awesome. Can't wait to see the final release ^^ It's my first issue sending to cpython, and sorry if there is any missing information I did not provide.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixestopic-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