[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

Nick Coghlan report at bugs.python.org
Sun Feb 25 21:41:46 EST 2018


Nick Coghlan <ncoghlan at gmail.com> added the comment:

With issue 17611 merged (which moves stack unwinding to the compiler), I expect the exact details of this problem to have changed, but the general problem still exists: Ctrl-C may lead to __exit__ (or __aexit__) not being called even after __enter__ (or __aenter__) returns successfully, and this may happen even for context managers implemented with uninterruptible methods (e.g. in C in CPython without calling back into any Python code).

----------

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


More information about the Python-bugs-list mailing list