[Python-checkins] r84256 - python/branches/py3k/Python/peephole.c

raymond.hettinger python-checkins at python.org
Sun Aug 22 10:39:49 CEST 2010


Author: raymond.hettinger
Date: Sun Aug 22 10:39:49 2010
New Revision: 84256

Log:
Issue 8403:  Don't mask KeyboardInterrupt during peephole operation.

Modified:
   python/branches/py3k/Python/peephole.c

Modified: python/branches/py3k/Python/peephole.c
==============================================================================
--- python/branches/py3k/Python/peephole.c	(original)
+++ python/branches/py3k/Python/peephole.c	Sun Aug 22 10:39:49 2010
@@ -159,13 +159,16 @@
             return 0;
     }
     if (newconst == NULL) {
-        PyErr_Clear();
+        if(!PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
+            PyErr_Clear();
         return 0;
     }
     size = PyObject_Size(newconst);
-    if (size == -1)
+    if (size == -1) {
+        if (PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
+            return 0;
         PyErr_Clear();
-    else if (size > 20) {
+    } else if (size > 20) {
         Py_DECREF(newconst);
         return 0;
     }
@@ -219,7 +222,8 @@
             return 0;
     }
     if (newconst == NULL) {
-        PyErr_Clear();
+        if(!PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
+            PyErr_Clear();
         return 0;
     }
 


More information about the Python-checkins mailing list