Commit 819a0645 authored by Raymond Hettinger's avatar Raymond Hettinger

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

parent 9117c751
...@@ -159,13 +159,16 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts) ...@@ -159,13 +159,16 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
return 0; return 0;
} }
if (newconst == NULL) { if (newconst == NULL) {
if(!PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
PyErr_Clear(); PyErr_Clear();
return 0; return 0;
} }
size = PyObject_Size(newconst); size = PyObject_Size(newconst);
if (size == -1) if (size == -1) {
if (PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
return 0;
PyErr_Clear(); PyErr_Clear();
else if (size > 20) { } else if (size > 20) {
Py_DECREF(newconst); Py_DECREF(newconst);
return 0; return 0;
} }
...@@ -219,6 +222,7 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts) ...@@ -219,6 +222,7 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts)
return 0; return 0;
} }
if (newconst == NULL) { if (newconst == NULL) {
if(!PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
PyErr_Clear(); PyErr_Clear();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment