Skip to content

gh-131878: Fix input of unicode characters with two or more code points in the REPL on Windows in vt mode - #133030

Closed
chris-eibl wants to merge 5 commits into
python:mainfrom
chris-eibl:fix_vt_windows
Closed

chris-eibl wants to merge 5 commits into
python:mainfrom
chris-eibl:fix_vt_windows

Conversation

@chris-eibl

@chris-eibl chris-eibl commented Apr 26, 2025 •

Copy link
Copy Markdown
Member

ab8efa7 is the fix on top of the reverted #130805.

49078f3 shows how I'd like to only accept bytes of length=1 in BaseEventQueue.push().

Only the tests used the int code path somewhat non-transparent by using strings which got converted to due to else ord(char) to bytes of length=1 again:

        ord_char = char if isinstance(char, int) else ord(char)
        char = bytes(bytearray((ord_char,)))

Maybe too much churn, thus just a draft.

elif self.__vt_support:
# If virtual terminal is enabled, scanning VT sequences
self.event_queue.push(rec.Event.KeyEvent.uChar.UnicodeChar)
for char in raw_key.encode(self.event_queue.encoding,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to use PEP-467 iterbytes() here :)

@sergey-miryanov

Copy link
Copy Markdown
Contributor

I like this proposal.

@chris-eibl

Copy link
Copy Markdown
Member Author

Closing since #131901 is merged and backported.

@chris-eibl chris-eibl closed this May 6, 2025
@chris-eibl
chris-eibl deleted the fix_vt_windows branch May 6, 2025 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants