Commits

Brian Kearns committed 18d3311

test and fix for id(complex) when imag < 0

Comments (0)

Files changed (2)

pypy/objspace/std/complexobject.py

 from rpython.rlib.rfloat import (
     formatd, DTSF_STR_PRECISION, isinf, isnan, copysign)
 from rpython.rlib import jit, rcomplex
-from rpython.rlib.rarithmetic import intmask
+from rpython.rlib.rarithmetic import intmask, r_ulonglong
 
 import math
 
         real = space.float_w(space.getattr(self, space.wrap("real")))
         imag = space.float_w(space.getattr(self, space.wrap("imag")))
         real_b = rbigint.fromrarith_int(float2longlong(real))
-        imag_b = rbigint.fromrarith_int(float2longlong(imag))
+        imag_b = rbigint.fromrarith_int(r_ulonglong(float2longlong(imag)))
         val = real_b.lshift(64).or_(imag_b).lshift(3).or_(rbigint.fromint(tag))
         return space.newlong_from_rbigint(val)
 

pypy/objspace/std/test/test_obj.py

             l.append(i + sys.maxint)
             l.append(i - sys.maxint)
             l.append(i + 1j)
+            l.append(i - 1j)
             l.append(1 + i * 1j)
+            l.append(1 - i * 1j)
             s = str(i)
             l.append(s)
             u = unicode(s)