[issue10042] functools.total_ordering fails to handle NotImplemented correctly

Katie Miller report at bugs.python.org
Mon Jul 8 08:56:51 CEST 2013


Katie Miller added the comment:

Attaching patch with Nick Coghlan's suggested code from msg140493 and associated tests. The tests extend the single test case that had already been added for earlier changes based on this bug. The tests check that a TypeError is raised, rather than a stack overflow occurring, when two instances of classes decorated with total_ordering that return NotImplemented, are compared, with each of the four comparison operators. For each operator, a test is included that would cause the recursion error if not for the code patch, as well as one where this error does not occur as there is no recursion.

Patch tested against the default branch.

----------
keywords: +patch
nosy: +codemiller
Added file: http://bugs.python.org/file30859/10042.patch

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


More information about the Python-bugs-list mailing list