pywinpty
pywinpty copied to clipboard
break in finally swallows exceptions
In https://github.com/andfoy/pywinpty/blob/694ad0b498b23b3386d1e30296f82a734c014fe3/winpty/ptyprocess.py#L358 there is a break statement in a finally block, which would swallow any in-flight exception.
This means that if any exception (including a BaseException such as KeyboardInterrupt) is raised from the try body, it will not propagate on as expected.
See also https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.