Issue 8403: Don't mask KeyboardInterrupt during peephole operation.
diff --git a/Python/peephole.c b/Python/peephole.c
index 7deb02d..9d06963 100644
--- a/Python/peephole.c
+++ b/Python/peephole.c
@@ -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;
}