]> granicus.if.org Git - python/commitdiff
Issue 8403: Don't mask KeyboardInterrupt during peephole operation.
authorRaymond Hettinger <python@rcn.com>
Sun, 22 Aug 2010 08:39:49 +0000 (08:39 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 22 Aug 2010 08:39:49 +0000 (08:39 +0000)
Python/peephole.c

index 7deb02d267a5b7c62525a9f0b991a24224978425..9d06963e2cf322c8c774feb7a42d5924e6b5119d 100644 (file)
@@ -159,13 +159,16 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
             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 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts)
             return 0;
     }
     if (newconst == NULL) {
-        PyErr_Clear();
+        if(!PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
+            PyErr_Clear();
         return 0;
     }