[pypy-svn] r12198 - pypy/dist/pypy/objspace/flow

pedronis at codespeak.net pedronis at codespeak.net
Wed May 11 20:13:37 CEST 2005


Author: pedronis
Date: Wed May 11 20:13:37 2005
New Revision: 12198

Modified:
   pypy/dist/pypy/objspace/flow/flowcontext.py
   pypy/dist/pypy/objspace/flow/model.py
Log:
changed a bit the interface guessbool <-> Link; we can use __slots__ for Links too



Modified: pypy/dist/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/flowcontext.py	(original)
+++ pypy/dist/pypy/objspace/flow/flowcontext.py	Wed May 11 20:13:37 2005
@@ -127,7 +127,8 @@
             egg = EggBlock(vars2, block, case)
             ec.pendingblocks.append(egg)
             link = Link(vars, egg, case)
-            link.__dict__.update(attach)
+            if attach:
+                link.extravars(**attach)
             links.append(link)
 
         block.exitswitch = w_condition

Modified: pypy/dist/pypy/objspace/flow/model.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/model.py	(original)
+++ pypy/dist/pypy/objspace/flow/model.py	Wed May 11 20:13:37 2005
@@ -53,10 +53,8 @@
         SingleGraphPage(self).display()
 
 class Link:
-    ##
-    ## __slots__ = """args target exitcase prevblock
-    ##               last_exception last_exc_value""".split()
-    # collision with flowcontext.py which wants to use update
+
+    __slots__ = """args target exitcase prevblock last_exception last_exc_value""".split()
     
     def __init__(self, args, target, exitcase=None):
         assert len(args) == len(target.inputargs), "output args mismatch"
@@ -69,6 +67,11 @@
         self.last_exception = None
         self.last_exc_value = None
 
+    # right now only exception handling needs to introduce new variables on the links
+    def extravars(self, last_exception=None, last_exc_value=None):
+        self.last_exception = last_exception
+        self.last_exc_value = last_exc_value
+
     def copy(self, rename=lambda x: x):
         newargs = [rename(a) for a in self.args]
         newlink = Link(newargs, self.target, self.exitcase)



More information about the Pypy-commit mailing list