[pypy-commit] pypy default: test and fix for id(complex) when imag < 0
bdkearns
noreply at buildbot.pypy.org
Mon Mar 11 10:29:57 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r62288:18d3311a2498
Date: 2013-03-11 05:29 -0400
http://bitbucket.org/pypy/pypy/changeset/18d3311a2498/
Log: test and fix for id(complex) when imag < 0
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
@@ -9,7 +9,7 @@
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
@@ -41,7 +41,7 @@
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)
diff --git a/pypy/objspace/std/test/test_obj.py b/pypy/objspace/std/test/test_obj.py
--- a/pypy/objspace/std/test/test_obj.py
+++ b/pypy/objspace/std/test/test_obj.py
@@ -203,7 +203,9 @@
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)
More information about the pypy-commit
mailing list