diff options
author | Barry Warsaw <barry@python.org> | 2005-08-15 17:32:56 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2005-08-15 17:32:56 (GMT) |
commit | 190a336331739dff1803b0780b58d58607d903bd (patch) | |
tree | 210f9ab9d626fd7cbf57b5368db240576df65dc9 | |
parent | ccb5e4dd6527b19e1bfd1c3247deddaa6b12eddd (diff) | |
download | cpython-190a336331739dff1803b0780b58d58607d903bd.zip cpython-190a336331739dff1803b0780b58d58607d903bd.tar.gz cpython-190a336331739dff1803b0780b58d58607d903bd.tar.bz2 |
Fix for SF bug # 900092, hotshot.stats.load assertion failure. This patch
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.
-rw-r--r-- | Lib/test/test_trace.py | 1 | ||||
-rw-r--r-- | Python/ceval.c | 22 |
2 files changed, 15 insertions, 8 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index f85c669..7f866fb 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -97,6 +97,7 @@ test_raise.events = [(0, 'call'), (-3, 'call'), (-2, 'line'), (-2, 'exception'), + (-2, 'return'), (2, 'exception'), (3, 'line'), (4, 'line'), diff --git a/Python/ceval.c b/Python/ceval.c index 85e3518..8a8fdbe 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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) { |