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

This commit is contained in:
Raymond Hettinger 2010-08-22 08:39:49 +00:00
parent 9117c75148
commit 819a064556
1 changed files with 8 additions and 4 deletions

View 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;
}