Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af3ba48

Browse files
committed
Merge: #8862: Fix curses cleanup with getchar is interrupted by a signal.
I have no idea how one would write a test for this. Patch by July Tikhonov.
2 parents 47bb16b + 779dab9 commit af3ba48

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ Core and Builtins
289289
Library
290290
-------
291291

292+
- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
293+
292294
- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO
293295
in subprocess, but the imap code assumes buffered IO. In Python2 this
294296
worked by accident. IMAP4_stream now explicitly uses buffered IO.

Modules/_cursesmodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,9 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
11381138
}
11391139
if (rtn == ERR) {
11401140
/* getch() returns ERR in nodelay mode */
1141-
PyErr_SetString(PyCursesError, "no input");
1141+
PyErr_CheckSignals();
1142+
if (!PyErr_Occurred())
1143+
PyErr_SetString(PyCursesError, "no input");
11421144
return NULL;
11431145
} else if (rtn<=255) {
11441146
return Py_BuildValue("C", rtn);

0 commit comments

Comments
 (0)