[pypy-svn] r27218 - in pypy/dist/pypy: annotation rpython/test

mwh at codespeak.net mwh at codespeak.net
Mon May 15 10:44:00 CEST 2006


Author: mwh
Date: Mon May 15 10:43:59 2006
New Revision: 27218

Modified:
   pypy/dist/pypy/annotation/builtin.py
   pypy/dist/pypy/rpython/test/test_llann.py
Log:
fix translation, by weakening an overstrong assert.


Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py	(original)
+++ pypy/dist/pypy/annotation/builtin.py	Mon May 15 10:43:59 2006
@@ -376,7 +376,7 @@
 from pypy.rpython.lltypesystem import lltype
 
 def malloc(T, n=None, s_flavor=None):
-    assert n is None or n.knowntype == int
+    assert n is None or (n.knowntype == int or issubclass(n.knowntype, pypy.rpython.rarithmetic.base_int))
     assert T.is_constant()
     if n is not None:
         n = 1

Modified: pypy/dist/pypy/rpython/test/test_llann.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_llann.py	(original)
+++ pypy/dist/pypy/rpython/test/test_llann.py	Mon May 15 10:43:59 2006
@@ -53,6 +53,16 @@
         s = self.annotate(llf, [])
         assert s.knowntype == int
 
+    def test_array_longlong(self):
+        from pypy.rpython.rarithmetic import r_longlong
+        A = GcArray(('v', Signed))
+        one = r_longlong(1)
+        def llf():
+            a = malloc(A, one)
+            return a[0].v
+        s = self.annotate(llf, [])
+        assert s.knowntype == int
+
     def test_prim_array(self):
         A = GcArray(Signed)
         def llf():



More information about the Pypy-commit mailing list