-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
GH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe #132440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
59d71b0
cca6155
1e61540
c60a727
ed035e5
69e8779
8ee232c
e67452b
396f48e
40b339a
1fbe240
2d59563
adb89ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -459,22 +459,26 @@ def get_event(self, block: bool = True) -> Event | None: | |||||||||||
key = f"ctrl {key}" | ||||||||||||
elif key_event.dwControlKeyState & ALT_ACTIVE: | ||||||||||||
# queue the key, return the meta command | ||||||||||||
self.event_queue.insert(Event(evt="key", data=key, raw=key)) | ||||||||||||
self.event_queue.insert(Event(evt="key", data=key, raw=raw_key)) | ||||||||||||
return Event(evt="key", data="\033") # keymap.py uses this for meta | ||||||||||||
return Event(evt="key", data=key, raw=key) | ||||||||||||
return Event(evt="key", data=key, raw=raw_key) | ||||||||||||
|
def getpending(self): |
where the two
getpending
implementations dutifully respect e.raw += e.raw
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When searching in the code base for getpending
I found
cpython/Lib/_pyrepl/windows_console.py
Lines 518 to 521 in 5d8e432
def getpending(self) -> Event: | |
"""Return the characters that have been typed but not yet | |
processed.""" | |
return Event("key", "", b"") |
which clearly seems to be a bug to me? Because even though WindowsConsole._read_input()
only reads one Windows INPUT_RECORD
per call, get_event
could have put something into self.event_queue
.
I've addressed this in https://github.com/python/cpython/pull/132889/files#r2059235071.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A missed opportunity when main was merged during development of #124119.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which @sergey-miryanov takes care of here as part of #131901.
So maybe I should remove this one, but I'd really like to keep the other two raw_key
changes (not only because I'd have to adapt almost all tests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO you should merge my branch here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can undo the change - then you won't have conflicts. I don't think we should (partially) merge between our two PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think you are right - we shouldn't merge our PRs. You can keep your changes - I'm OK if here will be conflict.
ambv marked this conversation as resolved.
Show resolved
Hide resolved
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix ``PyREPL`` on Windows: characters entered via AltGr are swallowed. Fix | ||
by Chris Eibl. | ||
chris-eibl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.