summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 56e5b71..3b2de9d 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -90,8 +90,12 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
/* try o.__length_hint__() */
hintmeth = _PyObject_LookupSpecial(o, "__length_hint__", &hintstrobj);
- if (hintmeth == NULL)
- return defaultvalue;
+ if (hintmeth == NULL) {
+ if (PyErr_Occurred())
+ return -1;
+ else
+ return defaultvalue;
+ }
ro = PyObject_CallFunctionObjArgs(hintmeth, NULL);
Py_DECREF(hintmeth);
if (ro == NULL) {
@@ -2592,6 +2596,8 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
}
return ok;
}
+ else if (PyErr_Occurred())
+ return -1;
return recursive_isinstance(inst, cls);
}
@@ -2655,6 +2661,8 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
}
return ok;
}
+ else if (PyErr_Occurred())
+ return -1;
return recursive_issubclass(derived, cls);
}