Skip to content
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

False positive for undefined-loop-variable with enumerate() #6593

Closed
jacobtylerwalls opened this issue May 12, 2022 · 0 comments · Fixed by #6602
Closed

False positive for undefined-loop-variable with enumerate() #6593

jacobtylerwalls opened this issue May 12, 2022 · 0 comments · Fixed by #6602
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code
Milestone

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented May 12, 2022

Bug description

for i, num in enumerate(range(3)):
    pass
print(i, num)

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:3: [W0631(undefined-loop-variable), ] Using possibly undefined loop variable 'i'
a.py:3: [W0631(undefined-loop-variable), ] Using possibly undefined loop variable 'num'

------------------------------------------------------------------
Your code has been rated at 3.33/10 (previous run: 0.00/10, +3.33)

Expected behavior

no msg. Notice that without enumerate, pylint doesn't emit messages.

Pylint version

pylint 2.14.0-b1
astroid 2.12.0-dev0
Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]

OS / Environment

No response

Additional dependencies

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant