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 on E1102 (not-callable) for methods called prev or next #4232

Closed
mathieui opened this issue Mar 13, 2021 · 3 comments · Fixed by #4348
Closed

False positive on E1102 (not-callable) for methods called prev or next #4232

mathieui opened this issue Mar 13, 2021 · 3 comments · Fixed by #4348
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@mathieui
Copy link

Steps to reproduce

(failing CI job on non-minimal code)
It took me a while to isolate a minimal use case, from my repeated testing:

  • There is a special case, in any object, for prev() and next()
  • It is only the case if the typing module is imported

Given a file test.py:

import typing

class MyClass:
    def __init__(self):
        pass

    def next(self):
        pass

    def prev(self):
        pass

    def toto(self):
        pass

    def placeholder(self):
        self.prev()
        self.next()
        self.toto()

Current behavior

Result of pylint -E test.py:

************* Module test
test.py:17:8: E1102: self.prev is not callable (not-callable)
test.py:18:8: E1102: self.next is not callable (not-callable)

Expected behavior

No error.

pylint --version output

Result of pylint --version output:

pylint 2.8.0-dev1
astroid 2.6.0-dev1
Python 3.9.2 (default, Feb 20 2021, 18:40:11) 
[GCC 10.2.0]

(installed both pylint and astroid from git to check)

@mathieui mathieui changed the title False positive on E1102 (not-callable) for a perfectly normal methods called prev or next False positive on E1102 (not-callable) for methods called prev or next Mar 13, 2021
@cdce8p
Copy link
Member

cdce8p commented Mar 13, 2021

This seems to be related to #3970 and possibly #3595

@mathieui
Copy link
Author

Indeed. I was mostly focused on the prev() which did not appear in my search before submitting the issue, but it certainly looks like a duplicate of both.

@Pierre-Sassoulas Pierre-Sassoulas added Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code labels Apr 5, 2021
@hippo91
Copy link
Contributor

hippo91 commented Apr 9, 2021

@mathieui i will close this issue as it seems to be a duplicate of at least #3970.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants