[pypy-svn] r69382 - in pypy/branch/faster-raise/pypy/interpreter: . test

arigo at codespeak.net arigo at codespeak.net
Wed Nov 18 16:32:56 CET 2009


Author: arigo
Date: Wed Nov 18 16:32:55 2009
New Revision: 69382

Modified:
   pypy/branch/faster-raise/pypy/interpreter/executioncontext.py
   pypy/branch/faster-raise/pypy/interpreter/test/test_executioncontext.py
Log:
Make sure we always reset f_forward to None, with a test.


Modified: pypy/branch/faster-raise/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/branch/faster-raise/pypy/interpreter/executioncontext.py	(original)
+++ pypy/branch/faster-raise/pypy/interpreter/executioncontext.py	Wed Nov 18 16:32:55 2009
@@ -143,11 +143,12 @@
             frame.f_back_some = f_back
             frame.f_back_forced = True
         if self.some_frame is frame:
-            self.some_frame = frame.f_back_some
+            f_back = frame.f_back_some
+            self.some_frame = f_back
         else:
             f_back = frame.f_back()
-            if f_back is not None:
-                f_back.f_forward = None
+        if f_back is not None:
+            f_back.f_forward = None
 
         self.framestackdepth -= 1
 

Modified: pypy/branch/faster-raise/pypy/interpreter/test/test_executioncontext.py
==============================================================================
--- pypy/branch/faster-raise/pypy/interpreter/test/test_executioncontext.py	(original)
+++ pypy/branch/faster-raise/pypy/interpreter/test/test_executioncontext.py	Wed Nov 18 16:32:55 2009
@@ -761,9 +761,22 @@
 
     def test_unchain_with_exception(self):
         ec, frame, frame2 = self.enter_two_jitted_levels()
+        ec.jitted = False
         frame3 = self.Frame(ec, frame2)
         ec._chain(frame3)
         frame3.last_exception = 3
+        assert ec.some_frame is frame3
         ec._unchain(frame3)
+        ec.jitted = True
         assert frame3.f_back_some is frame2
         assert frame3.f_back_forced
+        assert frame2._f_forward is None
+        assert not frame2.f_back_forced
+        assert frame2.f_back() is frame
+        assert frame._f_forward is frame2
+        #
+        # test for a bug: what happens if we _unchain frame2 without an exc.
+        assert frame2.last_exception is None
+        assert ec.some_frame is frame2
+        ec._unchain(frame2)
+        assert frame._f_forward is None



More information about the Pypy-commit mailing list