[pypy-svn] r13009 - pypy/dist/pypy/translator/goal

pedronis at codespeak.net pedronis at codespeak.net
Thu Jun 2 17:33:19 CEST 2005


Author: pedronis
Date: Thu Jun  2 17:33:18 2005
New Revision: 13009

Modified:
   pypy/dist/pypy/translator/goal/query.py
Log:
pbcaccess(<transl>) print nicely info about getattr access to PBCs



Modified: pypy/dist/pypy/translator/goal/query.py
==============================================================================
--- pypy/dist/pypy/translator/goal/query.py	(original)
+++ pypy/dist/pypy/translator/goal/query.py	Thu Jun  2 17:33:18 2005
@@ -45,7 +45,17 @@
             print f.__module__ or '?', f.__name__
             c += 1
     print c
-        
 
+def rep(bunch):
+    if len(bunch) == 1:
+        return "one", iter(bunch).next()
+    else:
+        t = dict.fromkeys([getattr(x, '__class__', type(x)) for x in bunch]).keys()
+        return "of types", t
 
+def pbcaccess(translator):
+    bk = translator.annotator.bookkeeper
+    for inf in bk.pbc_maximal_access_sets.root_info.itervalues():
+        objs = inf.objects
+        print len(objs), ' '.join(map(str,rep(objs))), inf.attrs.keys()
         



More information about the Pypy-commit mailing list