[Python-checkins] cpython (2.7): #8862: Fix curses cleanup with getchar is interrupted by a signal.

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


http://hg.python.org/cpython/rev/58980d0084cc
changeset:   82772:58980d0084cc
branch:      2.7
parent:      82768:f22b93b318a5
user:        R David Murray <rdmurray at bitdance.com>
date:        Tue Mar 19 16:26:53 2013 -0400
summary:
  #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
@@ -214,6 +214,8 @@
 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
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -885,7 +885,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