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

Skip to content

Commit 779dab9

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 7889944 + f5d7cc2 commit 779dab9

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
@@ -193,6 +193,8 @@ Core and Builtins
193193
Library
194194
-------
195195

196+
- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
197+
196198
- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO
197199
in subprocess, but the imap code assumes buffered IO. In Python2 this
198200
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)