Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-134210: handle signals in_curses.window.getch
#134326
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
vstinner commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I tried this change with the script: fromcursesimportwrapperimportctypesdefmain(window):window.nodelay(True)returnwindow.getch()print(wrapper(main)) Before (without this change), it displays After (with this change), it fails with the exception: So this change is backward incompatible. Is it deliberate? |
picnixz commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hum. No it's not meant to be broken! Only the signals should be handled, but otherwise we shouldn't raise an exception. |
picnixz commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Now I am bit conflicted. Ideally, we should return -1 for everythingor raise an exception as in the other functions. I don't know why it was historically chosen to return -1 for However, since I don't want to break stuff, I don't know how we can make a smooth transition, except by raising a warning before returning -1. |
For now, let's keep the same behavior (namely, -1 for |
picnixz commentedMay 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I could backport this as it's half a bugfix and half a feature. I'll only backport this to 3.14 as the layout of 3.13 is very different for curses (there was a conversion from static types to heap types and I don't think it made it to 3.13) |
Uh oh!
There was an error while loading.Please reload this page.
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.
LGTM
You might backport the change to 3.13 and 3.14 bugfix branches. |
Misc/NEWS.d/next/Library/2025-05-24-13-10-35.gh-issue-134210.0IuMY2.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
51762b6
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
GH-134783 is a backport of this pull request to the3.14 branch. |
…honGH-134326)(cherry picked from commit51762b6)Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
GH-134784 is a backport of this pull request to the3.13 branch. |
Uh oh!
There was an error while loading.Please reload this page.
_curses.window.getch
does not check for interruption signals as_curses.window.{getkey,get_wch}
do #134210