-
-
Notifications
You must be signed in to change notification settings - Fork 32k
_curses.window.getch
does not check for interruption signals as _curses.window.{getkey,get_wch}
do
#134210
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
Comments
Hi! I think this fix should raise an error when static int
_curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
int y, int x)
/*[clinic end generated code: output=980aa6af0c0ca387 input=bb24ebfb379f991f]*/
{
int rtn;
Py_BEGIN_ALLOW_THREADS
if (!group_right_1) {
rtn = wgetch(self->win);
}
else {
rtn = mvwgetch(self->win, y, x);
}
Py_END_ALLOW_THREADS
/* getch() returns ERR in nodelay mode */
if (PyErr_CheckSignals()) {
cursesmodule_state *state = get_cursesmodule_state_by_win(self);
const char *funcname = group_right_1 ? "mvwgetch" : "wgetch";
PyErr_Format(state->error, "getch(): %s(): no input", funcname);
return ERR;
}
return rtn;
} |
Another potential issue that I am seeing is a return type mismatch between |
It's not a mismatch. It's handled by Argument Clinic so it's fine. |
But I'll probably handle it as part of the rest of the cleanup |
…34326) (cherry picked from commit 51762b6) Co-authored-by: Bénédikt Tran <[email protected]>
…honGH-134326) (cherry picked from commit 51762b6) Co-authored-by: Bénédikt Tran <[email protected]>
#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]>
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
In
_curses.window.{getkey,get_wch}
, we are checking for possible interrupting signals and say:However, in
getch
, we say:In particular, I think we should also check for signals and possibly raise an exception if
PyErr_CheckSignals
fails, and otherwise return -1 as documented. (note thatgetch
returns ERR in no-delay mode, see https://linux.die.net/man/3/wgetch).CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
_curses.window.getch
#134326_curses.window.getch
(GH-134326) #134783_curses.window.getch
(GH-134326) #134784_curses.window.{get_wch,getkey}
#134646The text was updated successfully, but these errors were encountered: