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 #22732

Closed
8 tasks
iritkatriel opened this issue Oct 25, 2024 · 1 comment · Fixed by #22745
Closed
8 tasks

return in finally swallows exceptions #22732

iritkatriel opened this issue Oct 25, 2024 · 1 comment · Fixed by #22745

Comments

@iritkatriel
Copy link

Issue Report Checklist

  • [ x] Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • [x ] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

In

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

This means that if an unhanded exception (including 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.

What steps reproduce the problem?

Inspect source code.

What is the expected output? What do you see instead?

Avoid return in finally.

Versions

master branch

@ccordoba12
Copy link
Member

Hey @iritkatriel, thanks for noticing this issue in our code and reporting it. We'll address it in our 6.0.2 version, to be released this week.

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

Successfully merging a pull request may close this issue.

2 participants