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

Terry J. Reedy report at bugs.python.org
Fri Mar 24 15:34:42 EDT 2017


Terry J. Reedy added the comment:

https://docs.python.org/3/library/functions.html#len * does not specify the exception.  In such cases, we occasionally change exception in x.y.0 releases without prior notice other than News and What's New.  Also, I think unnecessarily exposing a compile-switch dependent internal detail, as now, is almost a bug.  So +1 to applying in 3.7

* The doc does not specify that 'length' cannot be non-negative.  Perhaps it should, so no-one will think that they can hijack '__len__' to return something that is not a length, as usually understood.

----------
nosy: +terry.reedy

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


More information about the Python-bugs-list mailing list