Serhiy Storchaka added the comment: Mis-behaving classes have to be written in C. If the __len__ method in Python class returns a negative value, ValueError is raised in slot_sq_length().
PySequence_GetItem() already contains an assertion that sq_length returns negative value only when an exception is set. The patch just extends this to other cases of calling sq_length and mq_length. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29838> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com