]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix for SF bug # 900092, hotshot.stats.load assertion failure. This patch
authorBarry Warsaw <barry@python.org>
Mon, 15 Aug 2005 17:32:56 +0000 (17:32 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 15 Aug 2005 17:32:56 +0000 (17:32 +0000)
restores the tracing of a 'return' event for exceptions that cause a function
to exit.  Also, update the unit test.

I will port to Python 2.5.

Lib/test/test_trace.py
Python/ceval.c

index f85c669630216d8b231cca19d4f0e26f4a6dd3df..7f866fbcf539ddbc2d7472e9abca07fd6e3d8766 100644 (file)
@@ -97,6 +97,7 @@ test_raise.events = [(0, 'call'),
                      (-3, 'call'),
                      (-2, 'line'),
                      (-2, 'exception'),
+                     (-2, 'return'),
                      (2, 'exception'),
                      (3, 'line'),
                      (4, 'line'),
index 85e35183f5e8924d8b9b3d01d734f496d72e56df..8a8fdbe7f94284aa79a46ea7ee884726eb72ee00 100644 (file)
@@ -2462,14 +2462,20 @@ fast_block_end:
 
 fast_yield:
        if (tstate->use_tracing) {
-               if (tstate->c_tracefunc
-                   && (why == WHY_RETURN || why == WHY_YIELD)) {
-                       if (call_trace(tstate->c_tracefunc,
-                                      tstate->c_traceobj, f,
-                                      PyTrace_RETURN, retval)) {
-                               Py_XDECREF(retval);
-                               retval = NULL;
-                               why = WHY_EXCEPTION;
+               if (tstate->c_tracefunc) {
+                       if (why == WHY_RETURN || why == WHY_YIELD) {
+                               if (call_trace(tstate->c_tracefunc,
+                                              tstate->c_traceobj, f,
+                                              PyTrace_RETURN, retval)) {
+                                       Py_XDECREF(retval);
+                                       retval = NULL;
+                                       why = WHY_EXCEPTION;
+                               }
+                       }
+                       else if (why == WHY_EXCEPTION) {
+                               call_trace_protected(tstate->c_tracefunc,
+                                                    tstate->c_traceobj, f,
+                                                    PyTrace_RETURN);
                        }
                }
                if (tstate->c_profilefunc) {