-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
inconsistent-return-statements not working in try branches #3468
Comments
Also worth noting that returning in some except clauses and not in others does not emit a warning either.
|
Actually I'm dumb, I misinterpreted what the issue was about, the error should be emitted. |
I think this now introduces a different bug
even if I replace parser.error() with an explicit function that is marked with The only solution now is to preinitialize:
Which isn't that great since it requires moving |
…ge of CI tests (#891) * Fix for inconsistent-return-statements errors from new pylint (2.7) References: - https://github.com/PyCQA/pylint/blob/5e04ce74faa0142fe3ff99eec08479cfaeb9584c/ChangeLog#L104 - pylint-dev/pylint#3468 * Pin pylint so that new releases do not spontaneously break CI tests * Another "fix" for what, I assume, is a recent change in pylint behavior
@same-id thanks for the report. I can reproduce. Can you open a new issue for this please? |
By the way another solution seems to add a |
Thanks! |
Steps to reproduce
Add a return in the try clause
Current behavior
Pylint emits no warning for
inconsistent-return-statements
. Note that it will emit a warning if the value is returned in the except clause.Expected behavior
Pylint should emit a warning for not explicitly returning a value if an exception is hit, be it in the except clause itself or at the end of the call.
pylint --version output
The text was updated successfully, but these errors were encountered: