[pypy-svn] r28965 - in pypy/dist/pypy/objspace/std: . test
arigo at codespeak.net
arigo at codespeak.net
Mon Jun 19 21:07:35 CEST 2006
Author: arigo
Date: Mon Jun 19 21:07:34 2006
New Revision: 28965
Modified:
pypy/dist/pypy/objspace/std/longobject.py
pypy/dist/pypy/objspace/std/test/test_longobject.py
Log:
(cfbolz, arigo)
A real bug found by test_descr.
Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py (original)
+++ pypy/dist/pypy/objspace/std/longobject.py Mon Jun 19 21:07:34 2006
@@ -471,7 +471,7 @@
raise OperationError(space.w_ValueError,
space.wrap("negative shift count"))
elif w_long2.sign == 0:
- return w_long1
+ return long__Long(space, w_long1)
try:
shiftby = int_w__Long(space, w_long2)
except OverflowError: # b too big
@@ -512,7 +512,7 @@
raise OperationError(space.w_ValueError,
space.wrap("negative shift count"))
elif w_long2.sign == 0:
- return w_long1
+ return long__Long(space, w_long1)
if w_long1.sign == -1:
w_a1 = invert__Long(space, w_long1)
w_a2 = rshift__Long_Long(space, w_a1, w_long2)
Modified: pypy/dist/pypy/objspace/std/test/test_longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_longobject.py (original)
+++ pypy/dist/pypy/objspace/std/test/test_longobject.py Mon Jun 19 21:07:34 2006
@@ -336,6 +336,16 @@
x = long2(1L<<100)
y = int(x)
assert type(y) == long
+ assert type(+long2(5)) is long
+ assert type(long2(5) << 0) is long
+ assert type(long2(5) >> 0) is long
+ assert type(long2(5) + 0) is long
+ assert type(long2(5) - 0) is long
+ assert type(long2(5) * 1) is long
+ assert type(1 * long2(5)) is long
+ assert type(0 + long2(5)) is long
+ assert type(-long2(0)) is long
+ assert type(long2(5) // 1) is long
def test_pow(self):
assert pow(0L, 0L, 1L) == 0L
More information about the Pypy-commit
mailing list