Author: Philip Jenvey <pjen...@underboss.org> Branch: remove-intlong-smm Changeset: r68569:1bf470bb200c Date: 2013-12-30 13:34 -0800 http://bitbucket.org/pypy/pypy/changeset/1bf470bb200c/
Log: hook in ints manually now that they no longer delegate 2 longs diff --git a/pypy/objspace/std/complexobject.py b/pypy/objspace/std/complexobject.py --- a/pypy/objspace/std/complexobject.py +++ b/pypy/objspace/std/complexobject.py @@ -1,6 +1,7 @@ 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 @@ -216,17 +217,21 @@ 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 <, <=, >, >=')) diff --git a/pypy/objspace/std/test/test_complexobject.py b/pypy/objspace/std/test/test_complexobject.py --- a/pypy/objspace/std/test/test_complexobject.py +++ b/pypy/objspace/std/test/test_complexobject.py @@ -185,6 +185,14 @@ 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) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit