Issue 631276: Exceptions raised by line trace function (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/37391

classification

Title: Exceptions raised by line trace function
Type: Stage:
Components: Interpreter Core Versions: Python 2.3

process

Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: mwh Nosy List: mwh, richiehindle
Priority: normal Keywords: patch

Created on 2002-10-30 22:06 by richiehindle, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Python-ceval.c.diff richiehindle,2002-10-30 22:06 Patch for ceval.c
trace_exception_bug.py richiehindle,2002-10-30 22:08 Script for reproducing the problem and testing the patch
Lib-test-test_trace.py.diff richiehindle,2002-10-31 21:34 Patch for test_trace.py as requested by mwh
Messages (6)
msg41508 - (view) Author: Richie Hindle (richiehindle) Date: 2002-10-30 22:06
Exceptions raised by line trace functions are not handled. I'm running the latest 2.3a0 (as of 30th October 2002). When a trace function called with an event of 'line' raises an exception, that exception is ignored by maybe_call_line_trace. This means that program never sees the exception, and that the next genuine exception to be raised gets muddled up with the one raised by the trace function. See the attached script for a demo. The bug (as far as I can tell) is that maybe_call_line_trace is ignoring the return value of call_trace. This patch makes maybe_call_line_trace pass that return value back to eval_frame, which then sets why to WHY_EXCEPTION and jumps to on_error.
msg41509 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-10-31 10:38
Logged In: YES user_id=6656 Blame for this one is easy to find... Patch looks OK. Could I ask you to munge the test into a patch to test_trace? Otherwise I'll do it, but maybe not today.
msg41510 - (view) Author: Richie Hindle (richiehindle) Date: 2002-10-31 14:38
Logged In: YES user_id=85414 Will do, later today.
msg41511 - (view) Author: Richie Hindle (richiehindle) Date: 2002-10-31 21:39
Logged In: YES user_id=85414 Here's the patch to test_trace.py. RaisingTraceFuncTestCase now tests each of the four trace events independently. Note that this doesn't show up the problem of the lost exception cropping up when another exception is raised - use the trace_exception_bug.py script if you want to see that.
msg41512 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-11-08 13:11
Logged In: YES user_id=6656 Checked in as: Lib/test/test_trace.py revision 1.5 Python/ceval.c revision 2.341 after a little light massaging (I just checked in a conflicting patch). Cheers!
msg41513 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-11-08 13:12
Logged In: YES user_id=6656 Is this Accepted or Fixed? Does it matter? Have I had enough of sf's tracker yet...?
History
Date User Action Args
2022-04-10 16:05:48 admin set github: 37391
2002-10-30 22:06:14 richiehindle create