Skip to content

Commit f5d7cc2

Browse files
committed
#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.
1 parent fcb6d6a commit f5d7cc2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ Core and Builtins
233233
Library
234234
-------
235235

236+
- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
237+
236238
- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO
237239
in subprocess, but the imap code assumes buffered IO. In Python2 this
238240
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
@@ -895,7 +895,9 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
895895
}
896896
if (rtn == ERR) {
897897
/* getch() returns ERR in nodelay mode */
898-
PyErr_SetString(PyCursesError, "no input");
898+
PyErr_CheckSignals();
899+
if (!PyErr_Occurred())
900+
PyErr_SetString(PyCursesError, "no input");
899901
return NULL;
900902
} else if (rtn<=255) {
901903
return Py_BuildValue("C", rtn);

0 commit comments

Comments
 (0)