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 E1101 #3331

Closed
hersi97 opened this issue Jan 6, 2020 · 1 comment
Closed

False positive E1101 #3331

hersi97 opened this issue Jan 6, 2020 · 1 comment

Comments

@hersi97
Copy link

hersi97 commented Jan 6, 2020

First of all, if this exact problem has already been reported, I am sorry. But I couldn't find anything resembling this, so here it is:

Steps to reproduce

For this file, when run with pylint -d C,R test.py, pylint incorrectly infers Sub as Base:

class Base:
    def __enter__(self):
        return self

    def __exit__(self, *err):
        pass


class Base2:
    def base_func2(self, something):
        return something


class Sub(Base):
    def some_func(self, string):
        print(string)


class Sub2(Base, Base2):
    def __init__(self, arg1, arg2):
        with Sub() as sub:
            sub.some_func(arg1)
            sub.some_func(arg2)
        self.sub = sub

Current behavior

Output:

************* Module test
test.py:22:12: E1101: Instance of 'Base' has no 'some_func' member (no-member)
test.py:23:12: E1101: Instance of 'Base' has no 'some_func' member (no-member)

-------------------------------------------------------------------
Your code has been rated at 4.12/10 (previous run: -2.94/10, +7.06)

Expected behavior

No errors

pylint --version output

$ pylint --version
pylint 2.4.4
astroid 2.3.3
Python 3.8.1 (default, Dec 21 2019, 20:57:38) 
[GCC 9.2.0]

Thank you in advance

@AWhetter
Copy link
Contributor

AWhetter commented Jan 6, 2020

Thanks for the report. This has already been fixed in astroid for #3157.

@AWhetter AWhetter closed this as completed Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants