pywinpty icon indicating copy to clipboard operation
pywinpty copied to clipboard

break in finally swallows exceptions

Open iritkatriel opened this issue 1 year ago • 0 comments

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.

iritkatriel avatar Oct 25 '24 16:10 iritkatriel