Author: Ronan Lamy <[email protected]>
Branch: framestate
Changeset: r74732:b8afe00c2ad2
Date: 2014-11-26 14:03 +0100
http://bitbucket.org/pypy/pypy/changeset/b8afe00c2ad2/
Log: move FOR_ITER
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -476,6 +476,22 @@
reader.end_block()
@bc_reader.register_opcode
+class FOR_ITER(BCInstruction):
+ 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)
+ except Raise as e:
+ if ctx.exception_match(e.w_exc.w_type, const(StopIteration)):
+ ctx.popvalue()
+ return self.arg
+ else:
+ raise
+
+
+@bc_reader.register_opcode
class SETUP_EXCEPT(BCInstruction):
def eval(self, ctx):
from rpython.flowspace.flowcontext import ExceptBlock
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -708,18 +708,6 @@
w_iterator = op.iter(w_iterable).eval(self)
self.pushvalue(w_iterator)
- def FOR_ITER(self, target):
- w_iterator = self.peekvalue()
- try:
- w_nextitem = op.next(w_iterator).eval(self)
- self.pushvalue(w_nextitem)
- except Raise as e:
- if self.exception_match(e.w_exc.w_type, const(StopIteration)):
- self.popvalue()
- return target
- else:
- raise
-
def SETUP_LOOP(self, target):
block = LoopBlock(self.stackdepth, target)
self.blockstack.append(block)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit