[Python-ideas] Protecting finally clauses of interruptions
yselivanov.ml at gmail.com
Tue Apr 3 02:02:06 CEST 2012
On 2012-04-02, at 7:36 PM, Paul Colomiets wrote:
> It's nice for python to have finally protection built-in,
> but I don't see how it can be implemented in a generic way.
How about adding some sort of 'interruption protocol'?
Say Threads, generators, and Greenlets will have a special
method called '_interrupt'. While it will be implemented
differently for each of them, it will work on the same
- check if the underlying code block is in one of its
- if it is: set a special flag to abort when the
frame's counter of 'finally' blocks reaches 0 to
raise the ExecutionInterrupt exception
- if it is not: raise the ExecutionInterrupt exception
More information about the Python-ideas