Skip to content

New REPL on Windows exits when accented character is pasted/typed#131878

@devdanzin

Description

@devdanzin

Crash report

What happened?

When pasting an accented character like ñ or é, or typing one such as ´p and pressing Enter, then up arrow, the new REPL on Windows will exit with the following error:

Python3.14.0a6+ (heads/fix_non_string_candidates_exit_repl-dirty:8008a588342, Mar292025, 08:15:) [MSCv.194364bit (AMD64)] onwin32Type"help", "copyright", "credits"or"license"formoreinformation. >>>Traceback (mostrecentcalllast): File"<frozen runpy>", line198, in_run_module_as_mainFile"<frozen runpy>", line88, in_run_codeFile"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\__main__.py", line6, in<module>__pyrepl_interactive_console() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\main.py", line59, ininteractive_consolerun_multiline_interactive_console(console) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\simple_interact.py", line137, inrun_multiline_interactive_consolestatement=multiline_input(more_lines, ps1, ps2) File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\readline.py", line389, inmultiline_inputreturnreader.readline() ~~~~~~~~~~~~~~~^^File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\reader.py", line750, inreadlineself.handle1() ~~~~~~~~~~~~^^File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\reader.py", line706, inhandle1event=self.console.get_event(block=False) File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\windows_console.py", line471, inget_eventself.event_queue.push(rec.Event.KeyEvent.uChar.UnicodeChar) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\ddini\PycharmProjects\cpython\Lib\_pyrepl\base_eventqueue.py", line88, inpushassertlen(self.buf) ==1^^^^^^^^^^^^^^^^^^AssertionError

In these cases, len(self.buf) is 3 instead of 1.

I'm running Python in Windows Terminal, chcp gives 850, changing it to 65001 (UTF-8) makes no difference.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Output from running 'python -VV' on the command line:

Python 3.14.0a6+ (heads/main-dirty:7c3692fe275, Mar 24 2025, 19:20:37) [MSC v.1942 64 bit (AMD64)]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixesOS-windowsrelease-blockerstdlibStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions