Commits

Ronan Lamy  committed c44eab9

Make "return" more similar to the other special cases in FlowEC.build_flow()

  • Participants
  • Parent commits b55ecb0
  • Branches translation-cleanup

Comments (0)

Files changed (1)

File pypy/objspace/flow/flowcontext.py

             block = self.pendingblocks.popleft()
             try:
                 self.recorder = frame.recording(block)
-                w_result = frame.run(self)
+                frame.run(self)
 
             except operation.OperationThatShouldNotBePropagatedError, e:
                 raise Exception(
             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)
 
     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