diff options
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 63b2041..5eb7b28 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -111,8 +111,12 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue) return 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) { @@ -2945,6 +2949,8 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls) } return ok; } + else if (PyErr_Occurred()) + return -1; } return recursive_isinstance(inst, cls); } @@ -3021,6 +3027,9 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls) } return ok; } + else if (PyErr_Occurred()) { + return -1; + } } return recursive_issubclass(derived, cls); } |