-
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
F821 Undefined name item
when assigning a set comprehension in an if-clause
#9230
Comments
Thanks! Does look like a bug. |
Is this the complete snippet? I'm unable to reproduce in the playground: https://play.ruff.rs/dd91b36b-c177-4e84-b190-368de569f6a4 |
You are right, I extracted only a small snippet, thought it was enough. I extracted now a larger snippet, stripped it down to the actual minimum: https://play.ruff.rs/27d1104c-b86e-45dc-98c6-fc6eac195bcb $ ruff --fix item.py
item.py:26:33: F821 Undefined name `item`
Found 1 error. As soon as I remove the class context, the error is gone Also, when I put everything inside Also updated the original post |
Thanks! Assume this has to do with accessing from within a class scope. We will fix. |
When running
ruff . --fix
on the whole project it gives this error message:F821 Undefined name `item`
But it works just as expected when executed
And extracting the set to a separate variable a line above works also fine
https://play.ruff.rs/27d1104c-b86e-45dc-98c6-fc6eac195bcb
The text was updated successfully, but these errors were encountered: