[pypy-svn] r70532 - in pypy/trunk/pypy/interpreter: . test

fijal at codespeak.net fijal at codespeak.net
Tue Jan 12 16:24:31 CET 2010


Author: fijal
Date: Tue Jan 12 16:24:30 2010
New Revision: 70532

Modified:
   pypy/trunk/pypy/interpreter/executioncontext.py
   pypy/trunk/pypy/interpreter/test/test_executioncontext.py
Log:
(pedronis, fijal)
Shave a yak. We didn't consider that c_* trace events should not clean the
last_exception bit


Modified: pypy/trunk/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/trunk/pypy/interpreter/executioncontext.py	(original)
+++ pypy/trunk/pypy/interpreter/executioncontext.py	Tue Jan 12 16:24:30 2010
@@ -300,9 +300,8 @@
                              'c_return', 'c_exception']:
                 return
 
-            last_exception = None
+            last_exception = frame.last_exception
             if event == 'leaveframe':
-                last_exception = frame.last_exception
                 event = 'return'
 
             assert self.is_tracing == 0 

Modified: pypy/trunk/pypy/interpreter/test/test_executioncontext.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_executioncontext.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_executioncontext.py	Tue Jan 12 16:24:30 2010
@@ -219,3 +219,26 @@
         """)
         events = space.unwrap(w_events)
         assert [i[0] for i in events] == ['c_call', 'c_return', 'c_call']
+
+    def test_profile_and_exception(self):
+        space = self.space
+        w_res = space.appexec([], """():
+        l = []
+        
+        def profile(*args):
+            l.append(sys.exc_info()[0])
+
+        import sys
+        try:
+            sys.setprofile(profile)
+            try:
+                x
+            except:
+                expected = sys.exc_info()[0]
+                assert expected is NameError
+                for i in l:
+                    assert expected is l[0]
+        finally:
+            sys.setprofile(None)
+        """)
+



More information about the Pypy-commit mailing list