allow any number to be returned from __length_hint__ (closes #15354)
This commit is contained in:
parent
f526297d13
commit
7d8a2e41a0
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue