[pypy-svn] r64137 - pypy/trunk/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Thu Apr 16 10:51:00 CEST 2009


Author: arigo
Date: Thu Apr 16 10:51:00 2009
New Revision: 64137

Modified:
   pypy/trunk/pypy/interpreter/pyframe.py
Log:
Rewrite these nested try:finally: so that the second one
is not inside the finally: part of the first one.  Helps(?)
stackless transform, at least.


Modified: pypy/trunk/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyframe.py	(original)
+++ pypy/trunk/pypy/interpreter/pyframe.py	Thu Apr 16 10:51:00 2009
@@ -109,24 +109,24 @@
         assert isinstance(self, self.space.FrameClass)
         executioncontext = self.space.getexecutioncontext()
         executioncontext.enter(self)
-        w_exitvalue = self.space.w_None
         try:
-            executioncontext.call_trace(self)
-            # 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 = self.last_instr + 1
-            w_exitvalue = self.dispatch(self.pycode, next_instr,
-                                        executioncontext)
-            rstack.resume_point("execute_frame", self, executioncontext, returns=w_exitvalue)
-            # on exit, we try to release self.last_exception -- breaks an
-            # obvious reference cycle, so it helps refcounting implementations
-            self.last_exception = None
-        finally:
+            w_exitvalue = self.space.w_None
             try:
-                executioncontext.return_trace(self, w_exitvalue)
+                executioncontext.call_trace(self)
+                # 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 = self.last_instr + 1
+                w_exitvalue = self.dispatch(self.pycode, next_instr,
+                                            executioncontext)
+                rstack.resume_point("execute_frame", self, executioncontext, returns=w_exitvalue)
+                # on exit, we try to release self.last_exception -- breaks an
+                # obvious reference cycle, so it helps refcounting implementations
+                self.last_exception = None
             finally:
-                executioncontext.leave(self)
+                executioncontext.return_trace(self, w_exitvalue)
+        finally:
+            executioncontext.leave(self)
         return w_exitvalue
     execute_frame.insert_stack_check_here = True
 



More information about the Pypy-commit mailing list