[Python-checkins] cpython (merge 3.3 -> default): Merge: #8862: Fix curses cleanup with getchar is interrupted by a signal.

r.david.murray python-checkins at python.org
Tue Mar 19 21:28:03 CET 2013


http://hg.python.org/cpython/rev/4b9705fe3b2a
changeset:   82771:4b9705fe3b2a
parent:      82767:d7dede0eabd8
parent:      82770:342ef2ed8d05
user:        R David Murray <rdmurray at bitdance.com>
date:        Tue Mar 19 16:26:19 2013 -0400
summary:
  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.

files:
  Misc/NEWS               |  2 ++
  Modules/_cursesmodule.c |  4 +++-
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -289,6 +289,8 @@
 Library
 -------
 
+- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
+
 - Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO
   in subprocess, but the imap code assumes buffered IO.  In Python2 this
   worked by accident.  IMAP4_stream now explicitly uses buffered IO.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1138,7 +1138,9 @@
     }
     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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list