Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r87142:51f3a7987d0c
Date: 2016-09-16 16:51 +0200
http://bitbucket.org/pypy/pypy/changeset/51f3a7987d0c/

Log:    Better fix for 47fa78e23bfb (in obscure cases like the 'return'
        trace raising)

diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -264,29 +264,27 @@
         try:
             executioncontext.call_trace(self)
             #
-            if operr is not None:
-                ec = self.space.getexecutioncontext()
-                next_instr = self.handle_operation_error(ec, operr)
-                self.last_instr = intmask(next_instr - 1)
-            else:
-                # Execution starts just after the last_instr.  Initially,
-                # last_instr is -1.  After a generator suspends it points to
-                # the YIELD_VALUE instruction.
-                next_instr = r_uint(self.last_instr + 1)
-                if next_instr != 0:
-                    self.pushvalue(w_inputvalue)
-            #
-            w_exitvalue = self.dispatch(self.pycode, next_instr,
-                                        executioncontext)
-            executioncontext.return_trace(self, w_exitvalue)
+            try:
+                if operr is not None:
+                    ec = self.space.getexecutioncontext()
+                    next_instr = self.handle_operation_error(ec, operr)
+                    self.last_instr = intmask(next_instr - 1)
+                else:
+                    # Execution starts just after the last_instr.  Initially,
+                    # last_instr is -1.  After a generator suspends it points 
to
+                    # the YIELD_VALUE instruction.
+                    next_instr = r_uint(self.last_instr + 1)
+                    if next_instr != 0:
+                        self.pushvalue(w_inputvalue)
+                w_exitvalue = self.dispatch(self.pycode, next_instr,
+                                            executioncontext)
+            finally:
+                executioncontext.return_trace(self, w_exitvalue)
             # it used to say self.last_exception = None
             # this is now done by the code in pypyjit module
             # since we don't want to invalidate the virtualizable
             # for no good reason
             got_exception = False
-        except Exception:
-            executioncontext.return_trace(self, self.space.w_None)
-            raise
         finally:
             executioncontext.leave(self, w_exitvalue, got_exception)
         return w_exitvalue
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to