gh-134210: handle signals in _curses.window.getch#134326
gh-134210: handle signals in _curses.window.getch#134326picnixz merged 6 commits intopython:mainfrom
_curses.window.getch#134326Conversation
|
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) |
|
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. |
|
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 <10796600+picnixz@users.noreply.github.com>
|
GH-134784 is a backport of this pull request to the 3.13 branch. |
_curses.window.getchdoes not check for interruption signals as_curses.window.{getkey,get_wch}do #134210