[pypy-svn] r20006 - pypy/branch/somepbc-refactoring/pypy/objspace/flow

arigo at codespeak.net arigo at codespeak.net
Fri Nov 18 12:14:40 CET 2005


Author: arigo
Date: Fri Nov 18 12:14:39 2005
New Revision: 20006

Modified:
   pypy/branch/somepbc-refactoring/pypy/objspace/flow/model.py
   pypy/branch/somepbc-refactoring/pypy/objspace/flow/objspace.py
Log:
Restored changes done in rev 19631 in the branch.


Modified: pypy/branch/somepbc-refactoring/pypy/objspace/flow/model.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/objspace/flow/model.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/objspace/flow/model.py	Fri Nov 18 12:14:39 2005
@@ -4,8 +4,8 @@
 # the below object/attribute model evolved from
 # a discussion in Berlin, 4th of october 2003
 from __future__ import generators
-from pypy.tool.uid import Hashable
-from pypy.tool.sourcetools import PY_IDENTIFIER
+from pypy.tool.uid import uid, Hashable
+from pypy.tool.sourcetools import PY_IDENTIFIER, nice_repr_for_func
 
 """
     memory size before and after introduction of __slots__
@@ -66,6 +66,13 @@
         return getsource(self.func)
     source = roproperty(getsource)
 
+    def __repr__(self):
+        if hasattr(self, 'func'):
+            fnrepr = nice_repr_for_func(self.func)
+        else:
+            fnrepr = self.name
+        return '<FunctionGraph of %s at 0x%x>' % (fnrepr, uid(self))
+
     def iterblocks(self):
         block = self.startblock
         yield block

Modified: pypy/branch/somepbc-refactoring/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/objspace/flow/objspace.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/objspace/flow/objspace.py	Fri Nov 18 12:14:39 2005
@@ -239,6 +239,7 @@
             name = name.replace(c, '_')
         ec = flowcontext.FlowExecutionContext(self, code, func.func_globals,
                                               constargs, closure, name)
+        ec.graph.func = func
         self.setup_executioncontext(ec)
         ec.build_flow()
         checkgraph(ec.graph)



More information about the Pypy-commit mailing list