diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2007-12-04 06:20:30 +0000 |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2007-12-04 06:20:30 +0000 |
commit | 79a082b7159d697f6b63e967f18e18cee0c82db7 (patch) | |
tree | f8e9895453f3fbccceadc8b7618a58a1a21791cf /Objects/listobject.c | |
parent | a74169b7c13bb081380a463541e80b7ba6934abd (diff) | |
download | cpython-git-79a082b7159d697f6b63e967f18e18cee0c82db7.tar.gz |
Fix issue #1553: An errornous __length_hint__ can make list() raise a
SystemError.
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 43e8a3f8ae..59674bf0ee 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -760,8 +760,9 @@ listextend(PyListObject *self, PyObject *b) /* Guess a result list size. */ n = _PyObject_LengthHint(b); if (n < 0) { - if (!PyErr_ExceptionMatches(PyExc_TypeError) && - !PyErr_ExceptionMatches(PyExc_AttributeError)) { + if (PyErr_Occurred() + && !PyErr_ExceptionMatches(PyExc_TypeError) + && !PyErr_ExceptionMatches(PyExc_AttributeError)) { Py_DECREF(it); return NULL; } |