python-humanfriendly icon indicating copy to clipboard operation
python-humanfriendly copied to clipboard

return in finally swallows exceptions

Open iritkatriel opened this issue 1 year ago • 0 comments

In https://github.com/xolox/python-humanfriendly/blob/6758ac61f906cd8528682003070a57febe4ad3cf/humanfriendly/testing.py#L542 there is a return statement in a finally block, which would swallow any in-flight exception.

This means that if the try block raises AssertionError, this will not be raised (in contradiction to the function's docstring).

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

iritkatriel avatar Oct 22 '24 21:10 iritkatriel