detecting unhandled exceptions within PyTrace_EXCEPTION

nealj mwarden22 at hotmail.com
Thu Jul 11 13:16:57 EDT 2002


When my application gets PyTrace_EXCEPTION in its trace function, I
would like to be able to tell an unhandled python exception from one
that is handled (within python).  Everything I've tried results in
either unhandled exceptions slipping by or handled exceptions getting
flagged.

Currently what I'm doing is looking at the frame's f_iblock and
f_blockstack members and triggering if the f_iblock is 0 or if the
block type at f_iblock-1 is SETUP_EXCEPT or SETUP_LOOP - that works
fine in my test cases but in an actual program it triggers on
exceptions that are multiple layers beneath the try/except block.



More information about the Python-list mailing list