luigi icon indicating copy to clipboard operation
luigi copied to clipboard

return in finally swallows exceptions

Open iritkatriel opened this issue 1 year ago • 0 comments

In https://github.com/spotify/luigi/blob/829fc0c36ecb4d0ae4f0680dec6d538577b249a2/luigi/contrib/presto.py#L169

there is a return statement in a finally block, which would swallow any in-flight exception.

This means that if an unhandled exception (including a BaseException such as KeyboardInterrupt) is raised from the try body, it will not propagate on as expected.

If the intention is to suppress all exceptions, I would propose to make this clear by using except BaseException.

See also https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.

iritkatriel avatar Oct 28 '24 09:10 iritkatriel