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

W0640 cell-var-from-loop false positive in Generator Comprehension of functions #10055

Open
nhdsd opened this issue Oct 29, 2024 · 0 comments
Open
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@nhdsd
Copy link

nhdsd commented Oct 29, 2024

Bug description

test = (lambda : print(i) for i in range(10))
for call in test:
    call()

Command used

pylint -sn --disable=C0114 test.py

Pylint output

test.py:1:23: W0640: Cell variable i defined in loop (cell-var-from-loop)

Expected behavior

No W0640, since the generator do generate functions as expected instead of generating print(9) for 10 times.

Pylint version

pylint 3.3.1
astroid 3.3.5
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep  6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)]

@nhdsd nhdsd added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 29, 2024
@mbyrnepr2 mbyrnepr2 added False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

2 participants