Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iritkatriel opened this issue Oct 22, 2024 · 0 comments

Comments

@iritkatriel
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant