[pypy-svn] r72361 - in pypy/branch/kill-python-h/pypy/rpython: lltypesystem test
arigo at codespeak.net
arigo at codespeak.net
Thu Mar 18 11:17:07 CET 2010
Author: arigo
Date: Thu Mar 18 11:17:06 2010
New Revision: 72361
Modified:
pypy/branch/kill-python-h/pypy/rpython/lltypesystem/ll_str.py
pypy/branch/kill-python-h/pypy/rpython/test/test_rint.py
Log:
Fixed the failing test.
Modified: pypy/branch/kill-python-h/pypy/rpython/lltypesystem/ll_str.py
==============================================================================
--- pypy/branch/kill-python-h/pypy/rpython/lltypesystem/ll_str.py (original)
+++ pypy/branch/kill-python-h/pypy/rpython/lltypesystem/ll_str.py Thu Mar 18 11:17:06 2010
@@ -1,6 +1,6 @@
from pypy.rpython.lltypesystem.lltype import GcArray, Array, Char, malloc
from pypy.rpython.annlowlevel import llstr
-from pypy.rlib.rarithmetic import r_uint, formatd
+from pypy.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong, formatd
CHAR_ARRAY = GcArray(Char)
@@ -8,6 +8,12 @@
return ll_int2dec(i)
ll_int_str._pure_function_ = True
+def ll_unsigned(i):
+ if isinstance(i, r_longlong) or isinstance(i, r_ulonglong):
+ return r_ulonglong(i)
+ else:
+ return r_uint(i)
+
def ll_int2dec(i):
from pypy.rpython.lltypesystem.rstr import mallocstr
temp = malloc(CHAR_ARRAY, 20)
@@ -15,9 +21,9 @@
sign = 0
if i < 0:
sign = 1
- i = r_uint(-i)
+ i = ll_unsigned(-i)
else:
- i = r_uint(i)
+ i = ll_unsigned(i)
if i == 0:
len = 1
temp[0] = '0'
@@ -52,9 +58,9 @@
sign = 0
if i < 0:
sign = 1
- i = r_uint(-i)
+ i = ll_unsigned(-i)
else:
- i = r_uint(i)
+ i = ll_unsigned(i)
if i == 0:
len = 1
temp[0] = '0'
@@ -94,9 +100,9 @@
sign = 0
if i < 0:
sign = 1
- i = r_uint(-i)
+ i = ll_unsigned(-i)
else:
- i = r_uint(i)
+ i = ll_unsigned(i)
while i:
temp[len] = hex_chars[i & 0x7]
i >>= 3
Modified: pypy/branch/kill-python-h/pypy/rpython/test/test_rint.py
==============================================================================
--- pypy/branch/kill-python-h/pypy/rpython/test/test_rint.py (original)
+++ pypy/branch/kill-python-h/pypy/rpython/test/test_rint.py Thu Mar 18 11:17:06 2010
@@ -107,7 +107,6 @@
assert res == '-' + oct(sys.maxint+1).replace('L', '').replace('l', '')
def test_str_of_longlong(self):
- py.test.skip("Fails. Do we want to fix it or not? Unclear.")
def f(i):
return str(i)
More information about the Pypy-commit
mailing list