[pypy-svn] r24844 - pypy/branch/explicit-exceptions/objspace/flow

mwh at codespeak.net mwh at codespeak.net
Thu Mar 23 01:04:38 CET 2006


Author: mwh
Date: Thu Mar 23 01:04:32 2006
New Revision: 24844

Modified:
   pypy/branch/explicit-exceptions/objspace/flow/model.py
Log:
remove cleanup from SpaceOperation.__slots__ and a few other references.



Modified: pypy/branch/explicit-exceptions/objspace/flow/model.py
==============================================================================
--- pypy/branch/explicit-exceptions/objspace/flow/model.py	(original)
+++ pypy/branch/explicit-exceptions/objspace/flow/model.py	Thu Mar 23 01:04:32 2006
@@ -192,14 +192,10 @@
         return txt
 
     def reallyalloperations(self):
-        "Iterate over all operations, including cleanup sub-operations."
+        """Iterate over all operations, including cleanup sub-operations.
+        XXX remove!"""
         for op in self.operations:
             yield op
-            cleanup = getattr(op, 'cleanup', None)
-            if cleanup is not None:
-                for lst in cleanup:
-                    for subop in lst:
-                        yield subop
 
     def getvariables(self):
         "Return all variables mentioned in this Block."
@@ -333,21 +329,14 @@
     __reduce__ = __reduce_ex__
 
 
-NOCLEANUP = object()
-
 class SpaceOperation(object):
-    __slots__ = "opname args result offset cleanup".split()
+    __slots__ = "opname args result offset".split()
 
-    def __init__(self, opname, args, result, offset=-1, cleanup=NOCLEANUP):
+    def __init__(self, opname, args, result, offset=-1):
         self.opname = intern(opname)      # operation name
         self.args   = list(args)  # mixed list of var/const
         self.result = result      # either Variable or Constant instance
         self.offset = offset      # offset in code string
-        if cleanup is not NOCLEANUP:
-            # None or a pair of tuples of operations:
-            # 0. operations to perform in all cases after 'self'
-            # 1. more operations to perform only in case of exception
-            self.cleanup = cleanup
 
     def __eq__(self, other):
         return (self.__class__ is other.__class__ and 
@@ -362,17 +351,8 @@
         return hash((self.opname,tuple(self.args),self.result))
 
     def __repr__(self):
-        s = "%r = %s(%s)" % (self.result, self.opname, ", ".join(map(repr, self.args)))
-        cleanup = getattr(self, 'cleanup', None)
-        if cleanup is not None:
-            lines = [s]
-            for case, lst in zip(("  finally: ", "   except: "), cleanup):
-                indent = case
-                for subop in lst:
-                    lines.append(indent + repr(subop))
-                    indent = ' ' * len(indent)
-            s = '\n'.join(lines)
-        return s
+        return "%r = %s(%s)" % (self.result, self.opname,
+                                ", ".join(map(repr, self.args)))
 
     def __reduce_ex__(self, *args):
         # avoid lots of useless list entities
@@ -523,8 +503,6 @@
                                             [copyvar(v) for v in op.args],
                                             copyvar(op.result))
                     copyop.offset = op.offset
-                    if hasattr(op, 'cleanup'):
-                        copyop.cleanup = copyoplist(op.cleanup)
                     result.append(copyop)
                 return result
             newblock.operations = copyoplist(block.operations)



More information about the Pypy-commit mailing list