handle errors from _PyObject_LookupSpecial when __get__ fails
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 @@
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 @@
}
return ok;
}
+ else if (PyErr_Occurred())
+ return -1;
}
return recursive_isinstance(inst, cls);
}
@@ -3021,6 +3027,9 @@
}
return ok;
}
+ else if (PyErr_Occurred()) {
+ return -1;
+ }
}
return recursive_issubclass(derived, cls);
}