[pypy-commit] pypy default: a failing test for using specialize.memo and specialize.arg together

alex_gaynor noreply at buildbot.pypy.org
Tue Apr 10 00:02:15 CEST 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r54271:09e76fd5aa32
Date: 2012-04-09 18:01 -0400
http://bitbucket.org/pypy/pypy/changeset/09e76fd5aa32/

Log:	a failing test for using specialize.memo and specialize.arg together

diff --git a/pypy/annotation/test/test_annrpython.py b/pypy/annotation/test/test_annrpython.py
--- a/pypy/annotation/test/test_annrpython.py
+++ b/pypy/annotation/test/test_annrpython.py
@@ -483,7 +483,7 @@
                 return a_str.strip(' ')
             elif n == 1:
                 return a_str.rstrip(' ')
-            else: 
+            else:
                 return a_str.lstrip(' ')
         s = a.build_types(f, [int, annmodel.SomeString(no_nul=True)])
         assert s.no_nul
@@ -3737,6 +3737,25 @@
         s = a.build_types(f, [int])
         assert s.listdef.listitem.range_step == 0
 
+    def test_specialize_arg_memo(self):
+        @objectmodel.specialize.memo()
+        def g(n):
+            return n
+        @objectmodel.specialize.arg(0)
+        def f(i):
+            return g(i)
+        def main(i):
+            if i == 2:
+                return f(i)
+            elif i == 3:
+                return f(i)
+            else:
+                raise NotImplementedError
+
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [int])
+        assert isinstance(s, SomeInteger)
+
 
 def g(n):
     return [0,1,2,n]


More information about the pypy-commit mailing list