[pypy-commit] pypy framestate: return blocks, not offsets, from FOR_ITER.eval()
rlamy
noreply at buildbot.pypy.org
Wed Nov 26 14:26:43 CET 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r74733:be6505ef80a3
Date: 2014-11-26 14:11 +0100
http://bitbucket.org/pypy/pypy/changeset/be6505ef80a3/
Log: return blocks, not offsets, from FOR_ITER.eval()
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -477,16 +477,25 @@
@bc_reader.register_opcode
class FOR_ITER(BCInstruction):
+ def bc_flow(self, reader):
+ block = reader.curr_block
+ block.operations.append(self)
+ self.exit = reader.get_block_at(self.arg)
+ self.body = reader.get_next_block()
+ block.set_exits([self.body, self.exit])
+ reader.end_block()
+
def eval(self, ctx):
from rpython.flowspace.flowcontext import Raise
w_iterator = ctx.peekvalue()
try:
w_nextitem = op.next(w_iterator).eval(ctx)
ctx.pushvalue(w_nextitem)
+ return self.body
except Raise as e:
if ctx.exception_match(e.w_exc.w_type, const(StopIteration)):
ctx.popvalue()
- return self.arg
+ return self.exit
else:
raise
More information about the pypy-commit
mailing list