-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I tried this change with the script: from curses import wrapper
import ctypes
def main(window):
window.nodelay(True)
return window.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? |
Hum. No it's not meant to be broken! Only the signals should be handled, but otherwise we shouldn't raise an exception. |
Now I am bit conflicted. Ideally, we should return -1 for everything or 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 |
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) |
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
Outdated
Show resolved
Hide resolved
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…34326) (cherry picked from commit 51762b6) Co-authored-by: Bénédikt Tran <[email protected]>
GH-134783 is a backport of this pull request to the 3.14 branch. |
…honGH-134326) (cherry picked from commit 51762b6) Co-authored-by: Bénédikt Tran <[email protected]>
GH-134784 is a backport of this pull request to the 3.13 branch. |
#134783) gh-134210: handle signals in `_curses.window.getch` (GH-134326) (cherry picked from commit 51762b6) Co-authored-by: Bénédikt Tran <[email protected]>
_curses.window.getch
does not check for interruption signals as_curses.window.{getkey,get_wch}
do #134210