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 not-callable when inheriting from typing.IO #10042

Open
Redoubts opened this issue Oct 24, 2024 · 0 comments
Open

False positive on not-callable when inheriting from typing.IO #10042

Redoubts opened this issue Oct 24, 2024 · 0 comments
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@Redoubts
Copy link

Redoubts commented Oct 24, 2024

Bug description

If I write a class which inherits the typing.IO abc, pylint complains that class instantiation is not callable when I provide a typevar as well (eg X[T](), something like list[str]()). I think I should be allowed to do this, especially in this case where I want to be explicit about the TypeVar's real type.

(lazy) Example. The error is at Z[str](), even though X[str]() and Y[str]() are fine.

import typing


class X(typing.Generic[typing.AnyStr]): ...


class Y(X[typing.AnyStr]): ...


class Z(typing.IO[typing.AnyStr]):
    """pretend full implementation here..."""


X[str]()
Y[str]()
Z[str]()  # not-callable

Command used

pylint x.py

Pylint output

************* Module x
x.py:16:0: E1102: Z[str] is not callable (not-callable)

------------------------------------------------------------------
Your code has been rated at 4.44/10 (previous run: 0.00/10, +4.44)

Expected behavior

10/10

Pylint version

pylint 3.3.1
astroid 3.3.5
Python 3.11.10

OS / Environment

Debian 11

@Redoubts Redoubts added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 24, 2024
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

2 participants