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

return in finally swallows exceptions #3005

Open
1 task done
iritkatriel opened this issue Oct 25, 2024 · 0 comments
Open
1 task done

return in finally swallows exceptions #3005

iritkatriel opened this issue Oct 25, 2024 · 0 comments
Labels

Comments

@iritkatriel
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In https://github.com/sanic-org/sanic/blob/main/sanic/server/websockets/impl.py#L437
and

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

This means that if an exception other than asyncio.CancelledError (including a BaseException such as KeyboardInterrupt) is raised from the try body, it will not propagate on as expected if this return statement is executed.

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

Code snippet

No response

Expected Behavior

No response

How do you run Sanic?

Sanic CLI

Operating System

Linux

Sanic Version

main branch

Additional context

No response

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

No branches or pull requests

1 participant