New submission from Fabio Zadrozny <>:

Right now, debuggers can deal with handled exceptions by detecting the 
'exception' event, but it's hard to know if the exception is handled or 
unhandled at that point (so, debuggers end up checking if it happens in a 
top-level function, but this isn't good if the user started the code and did a 
remote attach later on, where the top-level code is still user code).

My suggestion would be creating another event type (such as 'exception_return') 
which would be issued after the 'return' event with the same information passed 
on the 'exception' info so that debuggers can detect that some exception is 
unhandled (the 'return' would still be issued as usual to minimize breakage to 
existing debuggers).

Another option could be adding that information to the frame itself during a 
'return' event (and then removing right after calling the debugger to avoid any 
cycles) -- although I think the other option is better to avoid making the 
frame bigger.

components: Interpreter Core
messages: 321492
nosy: fabioz
priority: normal
severity: normal
status: open
title: Provide debuggers with a way to know that a function is exiting with an 
unhandled exception.
type: enhancement
versions: Python 3.8

Python tracker <>
Python-bugs-list mailing list

Reply via email to