-
-
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
Extend possibly-used-before-assignment to definitions in try then used in finally or after #2835
Comments
Thanks @lbenezriravin This makes sense. |
Closing as duplicate of #5524 |
This was actually not a duplicate see: #5764 (comment). A very relevant comment was made by @cdce8p in #5524 here:
|
Implementation tip: when checking whether the except handlers define a name, raise, or return, consider using |
pyright has |
Potentially related to #2615. Not sure if these would both be fixed by the same patch, so I'm making a new issue.
Is your feature request related to a problem? Please describe
The following code passes pylint:
But raises an
UnboundLocalError
when run.Describe the solution you'd like
Pylint already has an
undefined-loop-variable
warning for a similar case that could result in the same error:I feel that the former code should raise a warning if that latter code does. More generally, I don't expect
UnboundLocalError
from any code that passes pylint, but I'm not sure if that guarantee is possible.Additional context
Thanks for your work on this tool!
The text was updated successfully, but these errors were encountered: