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

Nick Coghlan report at bugs.python.org
Mon Sep 4 18:04:24 EDT 2017


Nick Coghlan added the comment:

https://github.com/ncoghlan/cpython/pull/2/files provides a test case that reliably reproduces the problem for both synchronous and asynchronous context managers.

It's inspired by Nathaniel's proposal above, but relies on a modified version of sys.settrace that runs the trace function after every opcode, not just every time the line number changes or we jump backwards in the bytecode.

Issue 31344 is a separate issue to add that underlying capability so we can write this test case.

----------

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


More information about the Python-bugs-list mailing list