[pypy-commit] pypy framestate: Kill WithBlock: it's exactly the same as FinallyBlock
rlamy
noreply at buildbot.pypy.org
Thu Feb 12 20:27:36 CET 2015
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r75838:98a783f80f0f
Date: 2015-02-11 02:57 +0000
http://bitbucket.org/pypy/pypy/changeset/98a783f80f0f/
Log: Kill WithBlock: it's exactly the same as FinallyBlock
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -590,8 +590,8 @@
@bc_reader.register_opcode
class SETUP_WITH(SetupInstruction):
def make_block(self, stackdepth):
- from rpython.flowspace.flowcontext import WithBlock
- return WithBlock(stackdepth, self.target)
+ from rpython.flowspace.flowcontext import FinallyBlock
+ return FinallyBlock(stackdepth, self.target)
def eval(self, ctx):
# A simpler version than the 'real' 2.7 one:
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -1182,7 +1182,11 @@
return self.handler # jump to the handler
class FinallyBlock(FrameBlock):
- """A try:finally: block. Stores the position of the exception handler."""
+ """A try:finally: or with: block
+
+ A with: block begins with SETUP_WITH and its handler is just
+ 'WITH_CLEANUP END_FINALLY'.
+ """
handles = FlowSignal
@@ -1192,9 +1196,3 @@
self.cleanupstack(ctx)
ctx.pushvalue(unroller)
return self.handler # jump to the handler
-
-
-class WithBlock(FinallyBlock):
-
- def handle(self, ctx, unroller):
- return FinallyBlock.handle(self, ctx, unroller)
More information about the pypy-commit
mailing list