[pypy-svn] r20385 - pypy/branch/somepbc-refactoring/pypy/translator/c/test

arigo at codespeak.net arigo at codespeak.net
Tue Nov 29 13:04:10 CET 2005


Author: arigo
Date: Tue Nov 29 13:04:09 2005
New Revision: 20385

Modified:
   pypy/branch/somepbc-refactoring/pypy/translator/c/test/test_annotated.py
Log:
Avoid confusion in pyobj with the default arguments of the
entry point function used as types in the tests.



Modified: pypy/branch/somepbc-refactoring/pypy/translator/c/test/test_annotated.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/translator/c/test/test_annotated.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/translator/c/test/test_annotated.py	Tue Nov 29 13:04:09 2005
@@ -13,13 +13,18 @@
 
     def annotatefunc(self, func):
         t = TranslationContext(simplifying=True)
-        # builds starting-types from func_defs 
-        argstypelist = []
-        if func.func_defaults:
-            for spec in func.func_defaults:
-                if isinstance(spec, tuple):
-                    spec = spec[0] # use the first type only for the tests
-                argstypelist.append(spec)
+        if hasattr(func, 'starting_types'):
+            argstypelist = func.starting_types
+        else:
+            # builds starting-types from func_defs 
+            argstypelist = []
+            if func.func_defaults:
+                for spec in func.func_defaults:
+                    if isinstance(spec, tuple):
+                        spec = spec[0] # use the first type only for the tests
+                    argstypelist.append(spec)
+            func.func_defaults = None
+            func.starting_types = argstypelist
         a = t.buildannotator()
         a.build_types(func, argstypelist)
         a.simplify()



More information about the Pypy-commit mailing list