Js2Py icon indicating copy to clipboard operation
Js2Py copied to clipboard

Exception can be swallowed by return in finally in examples/pyesprima.py

Open iritkatriel opened this issue 1 year ago • 0 comments

This return statement will swallow any in-flight exception.

If the try block raises an exception which is not of type PyJsException (such as a KeyboardInterrupt), or the except block raises any exception, you would expect that exception to bubble up. However, the return in the finally overrides it, so the exception is swallowed.

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

iritkatriel avatar Oct 22 '24 15:10 iritkatriel