[pypy-svn] r26161 - pypy/dist/pypy/translator/c/test

tismer at codespeak.net tismer at codespeak.net
Sun Apr 23 07:38:12 CEST 2006


Author: tismer
Date: Sun Apr 23 07:38:10 2006
New Revision: 26161

Modified:
   pypy/dist/pypy/translator/c/test/test_wrapping.py
Log:
baby steps. can finish quite soon

Modified: pypy/dist/pypy/translator/c/test/test_wrapping.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_wrapping.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_wrapping.py	Sun Apr 23 07:38:10 2006
@@ -9,7 +9,7 @@
 
 import sys, types
 
-P = False  # debug printing
+P = not False  # debug printing
 
 def get_annotation(func):
     argstypelist = []
@@ -32,7 +32,7 @@
 
     global _t # allow us to view later
     _t = t = TranslationContext(do_imports_immediately=False)
-    t.buildannotator()
+    ann = t.buildannotator()
     rtyper = t.buildrtyper()
     bk = rtyper.annotator.bookkeeper
     if not exports:
@@ -40,14 +40,16 @@
     all = [obj.__name__ for obj in exports]
     exports = exports + [('__all__', all)]
 
-    t.annotator.build_types(func, get_annotation(func))
+    ann.build_types(func, get_annotation(func))
 
     for obj in exports:
         if isinstance(obj, type):
             clsdef = bk.getuniqueclassdef(obj)
             rtyper.add_wrapper(clsdef)
         elif isinstance(obj, types.FunctionType):
-            pass#t.annotator.build_types(obj, get_annotation(obj))
+            if not ann.bookkeeper.getdesc(obj).querycallfamily():
+                # not annotated, so enforce it
+                ann.build_types(obj, get_annotation(obj))
 
     if view:
         t.viewcg()
@@ -246,7 +248,7 @@
     #bltn = BuiltinHelper()
     # less code:
     import __builtin__ as bltn
-    print bltn.list('hallo')
+    if P:print bltn.list('hallo')
     #from twisted.internet import reactor    
     #print dir(reactor)
     #whow this works
@@ -254,17 +256,17 @@
     # above is possible, this is probably a better compromise:
     isinstance = bltn.isinstance
     for obj in allobjs:
-        if isinstance(obj, types.FunctionType):
-            funcs.append( (obj.func_name, obj) )
-    print 'funcs=', funcs
-    print funcs[3:]
+        if isinstance(obj, types.BuiltinFunctionType):
+            funcs.append( (obj.__name__, obj) )
+    if P:print 'funcs=', funcs
+    if P:print funcs[3:]
     #funcs += [2, 3, 5]
     # not yet
     stuff = bltn.range(10)
-    print stuff[3:]
-    print stuff[:3]
-    print stuff[3:7]
-    print stuff[:-1]
+    if P:print stuff[3:]
+    if P:print stuff[:3]
+    if P:print stuff[3:7]
+    if P:print stuff[:-1]
     funcs.sort()
     return m
 



More information about the Pypy-commit mailing list