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

fijal at codespeak.net fijal at codespeak.net
Tue Nov 24 21:16:38 CET 2009


Author: fijal
Date: Tue Nov 24 21:16:36 2009
New Revision: 69615

Modified:
   pypy/trunk/pypy/interpreter/executioncontext.py
Log:
Improve situation overall:
* Change Exception into FrameChainMismatch to avoid confusion
* Move from catching superset of cases into catching subset of cases.
  The check should really be "next frame on the stack should have f_forward
  set to None", not sure if it's relevant since we're moving away from it
  anyway.


Modified: pypy/trunk/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/trunk/pypy/interpreter/executioncontext.py	(original)
+++ pypy/trunk/pypy/interpreter/executioncontext.py	Tue Nov 24 21:16:36 2009
@@ -11,6 +11,9 @@
                         space.wrap(frame),
                         space.wrap(event), w_arg)
 
+class FrameChainMismatch(Exception):
+    pass
+
 class ExecutionContext(object):
     """An ExecutionContext holds the state of an execution thread
     in the Python interpreter."""
@@ -142,8 +145,11 @@
         #assert frame is self.gettopframe() --- slowish
         if self.some_frame is frame:
             self.some_frame = frame.f_back_some
-            #if self.some_frame and self.some_frame.f_forward:
-            #    raise Exception()
+            if self.some_frame and self.some_frame.f_forward:
+                if self.some_frame.f_forward is frame:
+                    # and anything that actually goes forward from there,
+                    # but this is both inefficient and breaks tests
+                    raise FrameChainMismatch()
         else:
             f_back = frame.f_back()
             if f_back is not None:



More information about the Pypy-commit mailing list