diff options
author | Raymond Hettinger <python@rcn.com> | 2010-08-22 08:39:49 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-08-22 08:39:49 (GMT) |
commit | 819a0645567c452dc92852b36004b51c87154dc7 (patch) | |
tree | 0913810156f6e503c945c2c918d243167880b2f3 /Python/peephole.c | |
parent | 9117c751488a98810d758f15b3113527beb920ef (diff) | |
download | cpython-819a0645567c452dc92852b36004b51c87154dc7.zip cpython-819a0645567c452dc92852b36004b51c87154dc7.tar.gz cpython-819a0645567c452dc92852b36004b51c87154dc7.tar.bz2 |
Issue 8403: Don't mask KeyboardInterrupt during peephole operation.
Diffstat (limited to 'Python/peephole.c')
-rw-r--r-- | Python/peephole.c | 12 |
1 files changed, 8 insertions, 4 deletions
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 @@ 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; } |