[pypy-commit] pypy translation-cleanup: Make "return" more similar to the other special cases in FlowEC.build_flow()
rlamy
noreply at buildbot.pypy.org
Thu Aug 30 18:38:09 CEST 2012
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r56990:c44eab9b9f16
Date: 2012-08-11 03:34 +0100
http://bitbucket.org/pypy/pypy/changeset/c44eab9b9f16/
Log: Make "return" more similar to the other special cases in
FlowEC.build_flow()
diff --git a/pypy/objspace/flow/flowcontext.py b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -206,7 +206,7 @@
block = self.pendingblocks.popleft()
try:
self.recorder = frame.recording(block)
- w_result = frame.run(self)
+ frame.run(self)
except operation.OperationThatShouldNotBePropagatedError, e:
raise Exception(
@@ -241,7 +241,8 @@
except MergeBlock, e:
self.mergeblock(e.block, e.currentstate)
- else:
+ except Return:
+ w_result = frame.popvalue()
assert w_result is not None
link = self.make_link([w_result], self.graph.returnblock)
self.recorder.crnt_block.closeblock(link)
@@ -431,14 +432,10 @@
def run(self, ec):
self.frame_finished_execution = False
+ co_code = self.pycode.co_code
+ next_instr = self.last_instr
while True:
- co_code = self.pycode.co_code
- next_instr = self.last_instr
- try:
- while True:
- next_instr = self.handle_bytecode(co_code, next_instr, ec)
- except Return:
- return self.popvalue()
+ next_instr = self.handle_bytecode(co_code, next_instr, ec)
def YIELD_VALUE(self, _, next_instr):
assert self.is_generator
More information about the pypy-commit
mailing list