[pypy-commit] pypy framestate: simplify FrameBlock constructor

rlamy noreply at buildbot.pypy.org
Mon Nov 24 17:30:00 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r74689:fd00fc579edc
Date: 2014-11-22 01:27 +0000
http://bitbucket.org/pypy/pypy/changeset/fd00fc579edc/

Log:	simplify FrameBlock constructor

diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -339,7 +339,7 @@
 class SETUP_EXCEPT(BCInstruction):
     def eval(self, ctx):
         from rpython.flowspace.flowcontext import ExceptBlock
-        block = ExceptBlock(ctx, self.arg)
+        block = ExceptBlock(ctx.stackdepth, self.arg)
         ctx.blockstack.append(block)
 
 _unary_ops = [
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -732,11 +732,11 @@
                 raise
 
     def SETUP_LOOP(self, target):
-        block = LoopBlock(self, target)
+        block = LoopBlock(self.stackdepth, target)
         self.blockstack.append(block)
 
     def SETUP_FINALLY(self, target):
-        block = FinallyBlock(self, target)
+        block = FinallyBlock(self.stackdepth, target)
         self.blockstack.append(block)
 
     def SETUP_WITH(self, target):
@@ -748,7 +748,7 @@
         self.settopvalue(w_exit)
         w_enter = op.getattr(w_manager, const('__enter__')).eval(self)
         w_result = op.simple_call(w_enter).eval(self)
-        block = WithBlock(self, target)
+        block = WithBlock(self.stackdepth, target)
         self.blockstack.append(block)
         self.pushvalue(w_result)
 
@@ -1188,9 +1188,9 @@
     """Abstract base class for frame blocks from the blockstack,
     used by the SETUP_XXX and POP_BLOCK opcodes."""
 
-    def __init__(self, ctx, handlerposition):
+    def __init__(self, stackdepth, handlerposition):
         self.handlerposition = handlerposition
-        self.stackdepth = ctx.stackdepth
+        self.stackdepth = stackdepth
 
     def __eq__(self, other):
         return (self.__class__ is other.__class__ and


More information about the pypy-commit mailing list