allow any number to be returned from __length_hint__ (closes #15354)

This commit is contained in:
Benjamin Peterson 2012-07-14 17:53:55 -07:00
parent f526297d13
commit 7d8a2e41a0
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
PyErr_Clear();
return defaultvalue;
}
rv = PyLong_Check(ro) ? PyLong_AsSsize_t(ro) : defaultvalue;
rv = PyNumber_Check(ro) ? PyInt_AsSsize_t(ro) : defaultvalue;
Py_DECREF(ro);
return rv;
}