From a39c47aab0ec3032e25e8b0783616d50905ea9e2 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Tue, 19 Mar 2013 16:26:53 -0400 Subject: #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. --- Misc/NEWS | 2 ++ Modules/_cursesmodule.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 5c3c632..6b8cf1f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -214,6 +214,8 @@ Core and Builtins Library ------- +- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal. + - Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, retry the select() loop instead of bailing out. This is because select() can incorrectly report a socket as ready for reading (for example, if it diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 5f26c7f..b914e5f6 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -885,7 +885,9 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args) } if (rtn == ERR) { /* getch() returns ERR in nodelay mode */ - PyErr_SetString(PyCursesError, "no input"); + PyErr_CheckSignals(); + if (!PyErr_Occurred()) + PyErr_SetString(PyCursesError, "no input"); return NULL; } else if (rtn<=255) { return Py_BuildValue("c", rtn); -- cgit v0.12