diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-21 11:03:59 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-21 11:03:59 (GMT) |
commit | a710b331daee9e79ca90395feb6ce8c552e00568 (patch) | |
tree | a00e825052dabf853c875136b3e1832742634879 /Objects/listobject.c | |
parent | b285974c00fbf51af727d9330fa90443177390f4 (diff) | |
download | cpython-a710b331daee9e79ca90395feb6ce8c552e00568.zip cpython-a710b331daee9e79ca90395feb6ce8c552e00568.tar.gz cpython-a710b331daee9e79ca90395feb6ce8c552e00568.tar.bz2 |
SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear(). The same code fragment appears in
various guises in list.extend(), map(), filter(), zip(), and internally
in PySequence_Tuple().
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 08ab095..3b7358a 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -777,6 +777,11 @@ listextend(PyListObject *self, PyObject *b) /* Guess a result list size. */ n = PyObject_Size(b); if (n < 0) { + if (!PyErr_ExceptionMatches(PyExc_TypeError) && + !PyErr_ExceptionMatches(PyExc_AttributeError)) { + Py_DECREF(it); + return NULL; + } PyErr_Clear(); n = 8; /* arbitrary */ } |