[issue29988] (async) with blocks and try/finally are not as KeyboardInterrupt-safe as one might like

Nathaniel Smith report at bugs.python.org
Mon Sep 4 18:36:11 EDT 2017


Nathaniel Smith added the comment:

This would still provide value even if you have to do a GET_AWAITABLE in the protected region: the most common case is that __aenter__ is a coroutine function, which means that its __await__ is implemented in C and already protected against interrupts.

Also, to make this fully useful we need some way to protect arbitrary callables against interrupts anyway (to handle the case where the signal arrives during the actual __enter__ or __exit__ body), so saying that we also need to be able to protect __await__ isn't a big deal.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29988>
_______________________________________


More information about the Python-bugs-list mailing list