GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — GH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe by chris-eibl · Pull Request #132440 · python/cpython Conversation
|
| elif self.__vt_support: | ||
| # If virtual terminal is enabled, scanning VT sequences | ||
| self.event_queue.push(rec.Event.KeyEvent.uChar.UnicodeChar) | ||
| self.event_queue.push(raw_key) |
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
IMHO you should merge my branch here :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 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) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looking at the diff , previously
return Event( evt="key", data=code, raw=rec.Event.KeyEvent.uChar.UnicodeChar )
was used, which in the new code should have been raw_key?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actually, I was wondering why this change did not break anything, but AFAICT the raw member is not used in the whole code base except
cpython/Lib/_pyrepl/unix_console.py
Line 513 in 5d8e432
| def getpending(self): |
getpending implementations dutifully respect e.raw += e.raw :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Adding @vstinner, @eendebakpt and @paulie4 , since they were involved in #128389 and already talked about AltGr. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
PS: switching to an english keyboard layout, I can use the AltGr key like right-Alt, since it is not used in this keyboard layout :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The failing of Ubuntu (free-threading) is definitely unrelated, since this is a Windows specific change. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Do you think it'd be possible to add some tests for this change to ensure we don't accidentally regress again? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah, I've already thought about it, but am still unsure how to best do it. ATM, I am thinking of mocking cpython/Lib/_pyrepl/windows_console.py Line 411 in b87189d
to be able to test cpython/Lib/_pyrepl/windows_console.py Lines 426 to 432 in b87189d
AFAICT, all the existing tests just mock WDYT? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Agreed that we shouldn't be mocking |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Stan Ulbrych <[email protected]>
because it will be part of 131901, anywayy
because it is unused
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Excellent work again! Very well thought through.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @chris-eibl for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @chris-eibl and @ambv, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Will repeat here too - problem with backport because VT support was not backported #130805 (comment) (for completeness) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah, I am backporting the VT support too because it's the only way we can have a sensibly similar codebase for bug fixes. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ltGr on cmd.exe (pythonGH-132440) (cherry picked from commit 07f416a) Co-authored-by: Chris Eibl <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
|
GH-133460 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…n cmd.exe (GH-132440) (GH-133460) (cherry picked from commit 07f416a) Co-authored-by: Chris Eibl <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
… cmd.exe (pythonGH-132440) Co-authored-by: Stan Ulbrych <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.