Js2Py
Js2Py copied to clipboard
Exception can be swallowed by return in finally in examples/pyesprima.py
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.