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 no-member on member of generic grandparent class #3131

Closed
mthuurne opened this issue Sep 25, 2019 · 7 comments
Closed

False positive no-member on member of generic grandparent class #3131

mthuurne opened this issue Sep 25, 2019 · 7 comments

Comments

@mthuurne
Copy link
Contributor

Steps to reproduce

Run pylint on the following code:

from typing import Generic, TypeVar

T = TypeVar('T')

class Base(Generic[T]):
    def foo(self) -> None:
        print('bar')

class Intermediate(Base[T]):
    pass

class Concrete(Intermediate[int]):
    pass

obj = Concrete()
obj.foo()

Current behavior

The following message is reported:

E1101: Instance of 'Concrete' has no 'foo' member (no-member)

The message goes away if Concrete is made to inherit directly from Base, so without Intermediate in between them.

Expected behavior

No message is reported.

pylint --version output

pylint 2.4.0
astroid 2.3.0
Python 3.7.2 (default, Feb 26 2019, 13:02:33)
[GCC 7.3.1 20180323 [gcc-7-branch revision 258812]]

Notes

I wonder if this is related to #3129.

@PCManticore
Copy link
Contributor

Thanks, I can reproduce it as well.

mthuurne added a commit to boxingbeetle/astroid that referenced this issue Apr 27, 2020
mthuurne added a commit to boxingbeetle/astroid that referenced this issue Apr 27, 2020
mthuurne added a commit to boxingbeetle/astroid that referenced this issue Apr 27, 2020
mthuurne added a commit to boxingbeetle/astroid that referenced this issue Apr 27, 2020
mthuurne added a commit to boxingbeetle/astroid that referenced this issue May 1, 2020
@jamesbraza
Copy link

I believe this is fixed as of pylint 2.7 for the provided repro above

@radkujawa
Copy link

radkujawa commented Mar 9, 2021

I copied this example and tried pylint 2.7.2 and I still get this error, so I don't see how "this is fixed as of pylint 2.7 for the provided repro above".

pylint --version
pylint 2.7.2
astroid 2.5.1
Python 3.7.9 (default, Sep 25 2020, 07:46:23) 
[GCC 8.4.0]

@hippo91
Copy link
Contributor

hippo91 commented Apr 9, 2021

@jamesbraza @radkujawa both of you are right.
It was fixed some times ago but we have been forced to revert the fixing commit (pylint-dev/astroid@03d15b0) because it broke something else.
This will should be definitely fixed when pylint-dev/astroid#927 will be merged.

@NeilGirdhar
Copy link

NeilGirdhar commented Jun 24, 2021

Should this be closed? It appears to be fixed now! 😄

@Pierre-Sassoulas
Copy link
Member

Thank you for the reminder @NeilGirdhar, cleaning up issue is hard :)

@NeilGirdhar
Copy link

Least I can do to help. Thank you for resolving these so quickly.

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

Successfully merging a pull request may close this issue.

7 participants