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 can swallow exception (IDFGH-13928) #10

Closed
3 tasks done
iritkatriel opened this issue Oct 22, 2024 · 2 comments
Closed
3 tasks done

return in finally can swallow exception (IDFGH-13928) #10

iritkatriel opened this issue Oct 22, 2024 · 2 comments

Comments

@iritkatriel
Copy link

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

Avoid return in finally.

Actual behavior (suspected bug)

In


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

This means that if a BaseException (such as KeyboardInterrupt) is raised from the try body, or any exception is raised from an except: clause, it will not propagate on as expected.

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

Error logs or terminal output

No response

Steps to reproduce the behavior

See

Project release version

main branch

System architecture

other (details in Additional context)

Operating system

Linux

Operating system version

NA

Shell

ZSH

Additional context

No response

@github-actions github-actions bot changed the title return in finally can swallow exception return in finally can swallow exception (IDFGH-13928) Oct 22, 2024
@iritkatriel
Copy link
Author

Note also return in finally in

return curses.endwin()

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development Status: In Progress Issue is being worked on and removed Status: Opened Status: Selected for Development Issue is selected for development labels Oct 23, 2024
@Honza0297
Copy link
Collaborator

Hello @iritkatriel and thank you for finding this!

We will discuss this in internal code review and post the results here.

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

No branches or pull requests

3 participants