Issue1886

classification
Title: int lacks __gt__, breaks functools.total_ordering
Type: crash Severity: normal
Components: Library Versions: 2.7a1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: alex.gronholm Nosy List: alex.gronholm, fwierzbicki, irmen
Priority: high Keywords:

Created on 2012-05-17.10:03:52 by irmen, last changed 2012-10-28.13:07:59 by alex.gronholm.

Messages
msg7100 (view) Author: Irmen de Jong (irmen) Date: 2012-05-17.10:03:52
It seems that the 'int' type lacks at least one rich comparison operator namely __gt__. This breaks functools.total_ordering, for instance:

E:\projects\Mud>type error1.py
from functools import total_ordering

@total_ordering
class Ordered(object):
    def __eq__(self, other):
        return self is other
    def __lt__(self, other):
        return  False


E:\projects\Mud>\jython27\jython.bat error1.py
Traceback (most recent call last):
  File "error1.py", line 3, in <module>
    @total_ordering
  File "E:\jython27\Lib\functools.py", line 76, in total_ordering
    opfunc.__doc__ = getattr(int, opname).__doc__
AttributeError: type object 'int' has no attribute '__gt__'
msg7494 (view) Author: Alex Grönholm (alex.gronholm) Date: 2012-10-28.13:07:59
Fixed in changeset 77c30d41b6fa. Hopefully PyObject.equals() is the right choice for checking equality between types.
History
Date User Action Args
2012-10-28 13:07:59alex.gronholmsetstatus: open -> closed
assignee: fwierzbicki -> alex.gronholm
resolution: fixed
messages: + msg7494
nosy: + alex.gronholm
2012-05-18 17:31:54fwierzbickisetpriority: high
assignee: fwierzbicki
nosy: + fwierzbicki
2012-05-17 10:03:52irmencreate