About "Safe Asynchronous Exceptions for Python"

Giovanni Bajo noway at sorry.com
Wed Apr 30 19:56:15 EDT 2003


Hello,

I was reading http://www.cs.williams.edu/~freund/papers/02-lwl2.ps. I
understand the problem, but my first dumb question is: when a signal
happens, could the interpreter check if the next statement is a try
instruction (for a try/finally block) and, in that case, delay the execution
of the handler until the try instruction has been executed? In other words,
given the suggested resolution (in the syntactic sugar form), Python could
always consider the statement before a try/finally block as within an
implicit "initially:" block. Wouldn't this solve automatically the resource
acquisitition/usage/release idiom? In fact, to be exception safe one must
already put a try block IMMEDIATLY after the resource acquisition statement.

I can't even see how such a resolution would break existing code, since
signals are asynchronous so no code can be affected if their handling is
postponed a little bit later.

What am I missing?
-- 
Giovanni Bajo







More information about the Python-list mailing list