Serhiy Storchaka added the comment: I had similar doubts about this patch and needed opinions of other core developers.
> Maybe, if __len__() raises an OverflowError: call again the len(), but using > the "__len__" method instead of the slot? Following patch implements this idea. I don't like it because it is too complicated. I think that we should either document that raising an OverflowError by __len__() is normal and interpreted as true in Boolean context, or document that __len__() should return a value not larger than sys.maxsize, otherwise len() and bool() can raise an OverflowError (see issue15718). ---------- Added file: http://bugs.python.org/file46826/bool-no-overflow-double-call.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29840> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com