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

Armin Rigo armin.rigo at gmail.com
Mon Oct 29 12:49:39 EDT 2018


On Sat, 27 Oct 2018 at 01:50, Steven D'Aprano <steve at pearwood.info> wrote:
> [...]
> > So I was wondering if it would be possible to keep that context around
> > if you are in the debugger and rewind the execution point to before
> > the statement was triggered.
> I think what you are looking for is a reverse debugger[1] also known as
> a time-travel debugger.

I think it's a bit different.  A reverse debugger is here to debug
complex conditions in a (static) program.  What Ed is looking for is a
way to catch easy failures, fix the obviously faulty line, and
continue running the program.

Of course I can't help but mention to Ed that this is precisely the
kind of easy failures that are found by *testing* your code,
particularly if that's code that only runs after hours of other code
has executed.  *Never* trust yourself to write correct code if you
don't know that it is correct after waiting for hours.

But assuming that you really, really are allergic to tests, then what
you're looking for reminds me of long-ago Python experiments with
resumable exceptions and patching code at runtime.  Both topics are
abandoned now.  Resumable exceptions was a cool hack of the
interpreter that nobody really found a use for (AFAIR); patching code
at runtime comes with a pile of messes---it only works in the simple
cases, but there is no general solution for that.

A bientôt,


More information about the Python-Dev mailing list