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);
}
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index 65d4633..0dc4eef 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -241,9 +241,12 @@
return NULL;
}
}
- else
+ else {
reversed_meth = _PyObject_LookupSpecial(seq, "__reversed__",
&reversed_cache);
+ if (reversed_meth == NULL && PyErr_Occurred())
+ return NULL;
+ }
if (reversed_meth != NULL) {
PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL);
Py_DECREF(reversed_meth);
diff --git a/Objects/object.c b/Objects/object.c
index 08abe71..95072af 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -509,6 +509,8 @@
res = PyObject_CallFunctionObjArgs(func, NULL);
Py_DECREF(func);
}
+ else if (PyErr_Occurred())
+ return NULL;
}
/* Didn't find __unicode__ */