Commits

Philip Jenvey  committed 1bf470b

hook in ints manually now that they no longer delegate 2 longs

  • Participants
  • Parent commits 14419f6
  • Branches remove-intlong-smm

Comments (0)

Files changed (2)

File pypy/objspace/std/complexobject.py

 from pypy.interpreter import gateway
 from pypy.interpreter.error import OperationError
 from pypy.objspace.std import newformat
+from pypy.objspace.std.intobject import W_IntObject
 from pypy.objspace.std.model import registerimplementation, W_Object
 from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.floatobject import W_FloatObject, _hash_float
     if w_complex1.imagval:
         return space.w_False
     return space.eq(space.newfloat(w_complex1.realval), w_long2)
+eq__Complex_Int = eq__Complex_Long
 
 def eq__Long_Complex(space, w_long1, w_complex2):
     return eq__Complex_Long(space, w_complex2, w_long1)
+eq__Int_Complex = eq__Long_Complex
 
 def ne__Complex_Long(space, w_complex1, w_long2):
     if w_complex1.imagval:
         return space.w_True
     return space.ne(space.newfloat(w_complex1.realval), w_long2)
+ne__Complex_Int = ne__Complex_Long
 
 def ne__Long_Complex(space, w_long1, w_complex2):
     return ne__Complex_Long(space, w_complex2, w_long1)
+ne__Int_Complex = ne__Long_Complex
 
 def lt__Complex_Complex(space, w_complex1, w_complex2):
     raise OperationError(space.w_TypeError, space.wrap('cannot compare complex numbers using <, <=, >, >='))

File pypy/objspace/std/test/test_complexobject.py

         assert (5+0j) != large
         assert large != (5+0j)
 
+    def test_richcompare_boundaries(self):
+        z = 9007199254740992+0j
+        i = 9007199254740993
+        assert not complex.__eq__(z, i)
+        assert not complex.__eq__(z, long(i))
+        assert complex.__ne__(z, i)
+        assert complex.__ne__(z, long(i))
+
     def test_mod(self):
         raises(ZeroDivisionError, (1+1j).__mod__, 0+0j)