Skip to content

false positive no-member for static derived member #3803

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

Closed
przecze opened this issue Aug 28, 2020 · 1 comment · Fixed by #7095
Closed

false positive no-member for static derived member #3803

przecze opened this issue Aug 28, 2020 · 1 comment · Fixed by #7095
Labels

Comments

@przecze
Copy link

przecze commented Aug 28, 2020

I know there are problems for dynamically generated members, but in this case everything is static.

Steps to reproduce

execute pylint on this code:

class Base:
    label: str

class Derived(Base):
    label = "I exist!"

print(Derived.label)

Current behavior

test.py:7:6: E1101: Class 'Derived' has no 'label' member (no-member)

reported by pylint

Expected behavior

No no-member error reported by pylint

pylint --version output

~:$ pylint --version
pylint 2.6.0
astroid 2.4.2
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 
[GCC 9.3.0]

tested also on

~:$ pylint --version
pylint 2.4.4
astroid 2.3.3
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 
[GCC 9.3.0]
@hippo91
Copy link
Contributor

hippo91 commented Aug 29, 2020

@przecze thanks for the report.
I can reproduce it. An interesting fact is that the code below doesn't trigger the bug.

class Base:
    pass

class Derived(Base):
    label = "I exist!"

print(Derived.label)

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.

2 participants