[pypy-svn] r70533 - in pypy/branch/jit-profiling/pypy/interpreter: . test

fijal at codespeak.net fijal at codespeak.net
Tue Jan 12 16:26:19 CET 2010


Author: fijal
Date: Tue Jan 12 16:26:19 2010
New Revision: 70533

Modified:
   pypy/branch/jit-profiling/pypy/interpreter/executioncontext.py
   pypy/branch/jit-profiling/pypy/interpreter/test/test_executioncontext.py
Log:
(pedronis, fijal)
Merge 70531 to branch


Modified: pypy/branch/jit-profiling/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/branch/jit-profiling/pypy/interpreter/executioncontext.py	(original)
+++ pypy/branch/jit-profiling/pypy/interpreter/executioncontext.py	Tue Jan 12 16:26:19 2010
@@ -333,9 +333,8 @@
             if event < _PROFILING_FIRST or event > _PROFILING_LAST:
                 return
 
-            last_exception = None
+            last_exception = frame.last_exception
             if event == TRACE_LEAVEFRAME:
-                last_exception = frame.last_exception
                 event = TRACE_RETURN
 
             assert self.is_tracing == 0 

Modified: pypy/branch/jit-profiling/pypy/interpreter/test/test_executioncontext.py
==============================================================================
--- pypy/branch/jit-profiling/pypy/interpreter/test/test_executioncontext.py	(original)
+++ pypy/branch/jit-profiling/pypy/interpreter/test/test_executioncontext.py	Tue Jan 12 16:26:19 2010
@@ -225,3 +225,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