Serhiy Storchaka added the comment:

What if use _PyObject_HasLen?

if (_PyObject_HasLen(o)) {
    res = PyObject_Length(o);
    ...
}

hint = _PyObject_LookupSpecial(o, &PyId___length_hint__);
...

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19369>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to