summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index deb3ca5..8389a86 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -796,8 +796,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;
}