OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] short-circuiting runtime errors/exceptions in python debugger.


On 29Oct2018 1709, Nathaniel Smith wrote:
> I also wonder if it would be useful to give pdb the ability to break
> when an exception is *raised*, rather than when it's caught?

This is basically the first feature I implemented as an intern at
Microsoft back in 2011 :) (for Visual Studio's Python debugger)

It should be in the ptvsd and PyDev.Debugger packages, so any IDEs that
use those for debugging will support it (though it's not my
implementation any more, as far as I know).

Specifically, breaking on an exception is trivial, but filtering out the
cases that have handlers on the stack is nearly impossible. We got close
enough with looking at the AST of each caller that we didn't try any
harder than that. If you know *where* you're expecting the exception,
you could even filter on line number and then break when that line is on
the stack but before unwinding.

Cheers,
Steve