-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: handle for-loop variable shadowing correctly #10569
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
Conversation
Signed-off-by: Emmanuel Ferdman <[email protected]>
Pierre-Sassoulas
left a comment
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.
Thank you for opening this PR :)
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10569 +/- ##
=======================================
Coverage 95.90% 95.90%
=======================================
Files 176 176
Lines 19453 19456 +3
=======================================
+ Hits 18656 18659 +3
Misses 797 797
π New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Emmanuel Ferdman <[email protected]>
Pierre-Sassoulas
left a comment
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.
Great ! Let's rename doc/whatsnew/fragments/10562.bugfix.rst to doc/whatsnew/fragments/10562.bugfix and merge this :)
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Emmanuel Ferdman <[email protected]>
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit fd8fc82 |
Signed-off-by: Emmanuel Ferdman <[email protected]> (cherry picked from commit ed6b306)
(cherry picked from commit ed6b306) Signed-off-by: Emmanuel Ferdman <[email protected]> Co-authored-by: Emmanuel Ferdman <[email protected]>
Type of Changes
Description
Pylint incorrectly reported
undefined-variable(E0602) for code like:The problem is that in
get_next_to_consume(), the for-loop detection logic always setfound_nodes = Noneeven when detectingfor X in X:patterns, which eventually triggers the fallback undefined-variable error. The solution updates the logic to distinguish between two cases:item = 1; for item in item:- In this case, keep original definition.iteree in iteree:- In this case, trigger error.Closes #10562