diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-21 11:09:58 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-21 11:09:58 (GMT) |
commit | 9314d3261d5b81dca1a997a698b5d01f6a04299e (patch) | |
tree | 544513d5922d720bb9afa394fe94c17647707297 /Objects/listobject.c | |
parent | 8c86f88af8321fea0ab581b36e03e6acd4d1bc41 (diff) | |
download | cpython-9314d3261d5b81dca1a997a698b5d01f6a04299e.zip cpython-9314d3261d5b81dca1a997a698b5d01f6a04299e.tar.gz cpython-9314d3261d5b81dca1a997a698b5d01f6a04299e.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 */ } |