ignore AttributeErrors for classic classes

This commit is contained in:
Benjamin Peterson 2009-05-09 19:03:05 +00:00
parent 784d455066
commit a7dc949e17
1 changed files with 2 additions and 1 deletions

View File

@ -116,7 +116,8 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
ro = PyObject_CallFunctionObjArgs(hintmeth, NULL); ro = PyObject_CallFunctionObjArgs(hintmeth, NULL);
Py_DECREF(hintmeth); Py_DECREF(hintmeth);
if (ro == NULL) { if (ro == NULL) {
if (!PyErr_ExceptionMatches(PyExc_TypeError)) if (!PyErr_ExceptionMatches(PyExc_TypeError) &&
!PyErr_ExceptionMatches(PyExc_AttributeError))
return -1; return -1;
return defaultvalue; return defaultvalue;
} }