Join of two type concrete type objects may be considered abstract
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
Research direction
Start with the reproducer in the issue and inspect how mypy computes joins of callable type objects representing A and B. Determine whether t0 should be accepted without the abstract-class error, and assess whether the same behavior needs correction for meets.
Written by the indexing model from the issue text.
Description
Mypy complains about the following code even though it looks fine:
from abc import abstractmethod
class Base:
@abstractmethod
def f(self) -> None: pass
class A(Base):
def f(self) -> None: pass
class B(Base):
def f(self) -> None: pass
t = [A, B]
t[0]() # Cannot instantiate abstract class 'Base' with abstract attribute 'f'
It looks like the join of two callables representing type objects should perhaps be Type[x] instead of another callable, since mypy basically assumes that a callable represents a specific type object, not something that can also be any subclass. The same issue probably applies to meets as well.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100