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

Missing undefined-variable for metaclass custom keyword argument #4021

Closed
douglas-raillard-arm opened this issue Jan 8, 2021 · 1 comment · Fixed by #5179
Closed

Missing undefined-variable for metaclass custom keyword argument #4021

douglas-raillard-arm opened this issue Jan 8, 2021 · 1 comment · Fixed by #5179
Labels
Milestone

Comments

@douglas-raillard-arm
Copy link

Hello, here is an "interesting" corner case, derived from the one I posted to exhibit #1630

Since I'm not sure if that is sharing the same root cause, I opened a separate ticket.

Steps to reproduce

class Meta(type):
    def __new__(cls, name, bases, dct, *args, x=None, **kwargs):
        print(x)
        return super().__new__(cls, name, bases, dct, *args, **kwargs)

class C(metaclass=Meta, x=var):
    pass

Current behavior

Not reporting any error.

Expected behavior

test.py:6:6: E0602: Undefined variable 'var' (undefined-variable)

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.8.7 (default, Dec 24 2020, 17:53:09) 
[GCC 10.2.0]
@PCManticore
Copy link
Contributor

Thanks, this makes sense.

DanielNoord added a commit to DanielNoord/pylint that referenced this issue Oct 18, 2021
DanielNoord added a commit that referenced this issue Oct 18, 2021
This closes #4021
@DanielNoord DanielNoord added this to the 2.12.0 milestone Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants