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 undefined-variable #3434

Closed
sam-s opened this issue Mar 3, 2020 · 1 comment
Closed

False positive undefined-variable #3434

sam-s opened this issue Mar 3, 2020 · 1 comment
Labels

Comments

@sam-s
Copy link

sam-s commented Mar 3, 2020

Steps to reproduce

import collections

l = ["a","b","c"]

class Foo(collections.namedtuple("Foo",[x+"_foo" for x in l])):
    pass

Current behavior

error (E0602, undefined-variable, Foo) Undefined variable 'x'

for the class Foo line

Expected behavior

no diagnostics - the code works fine

pylint --version output

pylint 2.4.4
astroid 2.3.3
Python 3.7.6 (default, Dec 30 2019, 19:38:28) 
[Clang 11.0.0 (clang-1100.0.33.16)]
Pierre-Sassoulas pushed a commit that referenced this issue Jul 12, 2020
)

Fix scoping for function annotations, decorators and base classes

Closes #1082, #3434, #3461

Reduce number of branches in variables checker

Co-authored-by: Andrew Simmons <a.simmons@deakin.edu.au>
@Pierre-Sassoulas
Copy link
Member

Fixed in #3713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants