[Python-ideas] Protecting finally clauses of interruptions

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 5 00:18:46 CEST 2012

Paul Colomiets wrote:

> Do you mean put callback in a frame, which get
> executed at next bytecode just like signal handler,
> except it waits until finally clause is executed?

It wouldn't be in each frame -- probably it would just
be a global hook that gets called whenever a finally-counter
anywhere gets decremented from 1 to 0. It would be passed
the relevant frame so it could decide what to do from

I don't think it would have much performance impact, since
it would only get triggered by exiting a finally block.
Nothing would need to happen per bytecode or anything
like that.


More information about the Python-ideas mailing list