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

Add else statement in all try/except block where try was with return … #204

Merged
merged 2 commits into from
May 17, 2024

Conversation

jpjarnoux
Copy link
Member

According to the documentation: http://docs.python.org/reference/compound_stmts.html#the-try-statement
A try/except block should not have a return in the try block.
This provoked some invisible bugs.
I added an else statement, which returns the value found in the try statement.
Note that a return in the except statement is perfectly correct.

@JeanMainguy JeanMainguy self-requested a review March 26, 2024 10:37
@axbazin axbazin merged commit dc10ac4 into dev May 17, 2024
5 checks passed
@axbazin axbazin deleted the FixTryReturn branch May 17, 2024 07:25
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

Successfully merging this pull request may close these issues.

2 participants