[issue29839] Avoid raising OverflowError in len() when __len__() returns negative large value

Serhiy Storchaka report at bugs.python.org
Sun Apr 16 03:05:36 EDT 2017


Serhiy Storchaka added the comment:

> The doc does not specify that 'length' cannot be non-negative.

It does. https://docs.python.org/3/reference/datamodel.html#object.__len__

.. method:: object.__len__(self)

   Called to implement the built-in function :func:`len`.  Should return the length
   of the object, an integer ``>=`` 0.

----------
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29839>
_______________________________________


More information about the Python-bugs-list mailing list