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.
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.
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.
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!