Repository navigation
New REPL on Windows exits when accented character is pasted/typed #131878
Description
Activity
- addedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Mar 29, 2025 Related? #130273
This is a bug and not a crash.
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortopic-replRelated to the interactive shellRelated to the interactive shelland removedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Mar 29, 2025 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Mar 29, 2025 This is os-windows specific. IIRC there was recently an issue about this, it was closed.
Yes looking at #130804 it seems it was not fully resolved, and it is presumably a side effect of the merged pr, do we want to reopen that?
@StanFromIreland
It is in another execution path, so I think this should be a new issue (despite it looks similar).cpython/Lib/_pyrepl/base_eventqueue.py
Lines 72 to 89 in fccf9ab
def push(self, char: int | bytes | str) -> None: """ Processes a character by updating the buffer and handling special key mappings. """ ord_char = char if isinstance(char, int) else ord(char) if ord_char > 255: assert isinstance(char, str) char = bytes(char.encode(self.encoding, "replace")) self.buf.extend(char) else: char = bytes(bytearray((ord_char,))) self.buf.append(ord_char) if char in self.keymap: if self.keymap is self.compiled_keymap: # sanity check, buffer is empty when a special key comes assert len(self.buf) == 1 k = self.keymap[char] It is in the same path you modified, your changes are the last ones to modify the buffer before the check?
- added3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes
on Mar 29, 2025 @StanFromIreland Oh, I get what you mean. Yes, it is related, but I think it is related to
keymapandcompiled_keymapalso, so it extends my previous patch a bit. I will test and fix. Can you assign it to me?Also, I should mention that it is not backported to 3.13 due conflicts - #130805 (comment)
4 remaining items
- added 4 commits that reference this issue
on May 5, 2025 Fixed, thank you all!
Reacted by Chris Eibl, Hugo van Kemenade and Sergey Miryanov- moved this from Todo to Done in Release and Deferred blockers 🚫
on May 5, 2025
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
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:
In these cases,
len(self.buf)is 3 instead of 1.I'm running Python in Windows Terminal,
chcpgives 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