Merged revisions 72907 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72907 | benjamin.peterson | 2009-05-24 21:40:21 -0500 (Sun, 24 May 2009) | 1 line

  handle errors from _PyObject_LookupSpecial when __get__ fails
........
This commit is contained in:
Benjamin Peterson 2009-05-25 03:10:48 +00:00
parent 14a3dd716d
commit 94c65d9a8f
5 changed files with 37 additions and 7 deletions

View file

@ -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);
}