[pypy-svn] r10709 - in pypy/dist/pypy: objspace/std translator/test
pedronis at codespeak.net
pedronis at codespeak.net
Fri Apr 15 20:47:38 CEST 2005
Author: pedronis
Date: Fri Apr 15 20:47:37 2005
New Revision: 10709
Modified:
pypy/dist/pypy/objspace/std/longobject.py
pypy/dist/pypy/translator/test/test_annrpython.py
Log:
guarantee that newfloat arg is float
tests for list(<tuple>) annotation
Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py (original)
+++ pypy/dist/pypy/objspace/std/longobject.py Fri Apr 15 20:47:37 2005
@@ -257,7 +257,7 @@
raise OperationError(space.w_ZeroDivisionError,
space.wrap("long division"))
z = x / y
- return space.newfloat(z)
+ return space.newfloat(float(z))
def floordiv__Long_Long(space, w_long1, w_long2): #YYYYYY
x = w_long1.longval()
Modified: pypy/dist/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_annrpython.py (original)
+++ pypy/dist/pypy/translator/test/test_annrpython.py Fri Apr 15 20:47:37 2005
@@ -855,6 +855,26 @@
s = a.build_types(f, [str,int,int])
assert s.knowntype == str
+ def test_list_tuple(self):
+ def g0(x):
+ return list(x)
+ def g1(x):
+ return list(x)
+ def f(n):
+ l1 = g0(())
+ l2 = g1((1,))
+ if n:
+ t = (1,)
+ else:
+ t = (2,)
+ l3 = g1(t)
+ return l1, l2, l3
+ a = RPythonAnnotator()
+ s = a.build_types(f, [bool])
+ assert listitem(s.items[0]) == annmodel.SomeImpossibleValue()
+ assert listitem(s.items[1]).knowntype == int
+ assert listitem(s.items[2]).knowntype == int
+
def g(n):
return [0,1,2,n]
More information about the Pypy-commit
mailing list