-
Notifications
You must be signed in to change notification settings - Fork 178
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
Track locals() #343
base: main
Are you sure you want to change the base?
Track locals() #343
Conversation
Note this also corrects handling of |
if isinstance(scope, GeneratorScope): | ||
scope = self.scopeStack[-2] | ||
for binding in scope.values(): | ||
binding.used = (self.scope, node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be changed to
if not binding.used:
binding.used = (self.scope, node)
Then at the end of the scope, any bindings used only by locals()
could be a different type of message.
See #333 (comment)
IMHO Having it warn but as a distinct error message that could be silenced by flake8 or whatever seems like the best solution. |
I agree that I would prefer to tackle that new error report in a separate PR, and limit this one to only correct reporting of |
What exactly is the import * change you are referring to? Did that behavior change recently? |
No, I am referring to 1.1.0 change, 0532189 |
I see. I tested master and it sill warns about everything with import *, but sometimes has a better error message. Does this do the same thing for locals? The test makes it look like there are exceptions for locals, where using |
Fixes #136
Fixes #333