`[type-abstract]` reports with a `tuple` when the actual type is a `dict`
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report, To Reproduce, & Actual Behaviour
See mypy Playground
from abc import ABC, abstractmethod
class Abstract(ABC):
@abstractmethod
def method(self) -> None: ...
class Unimplemented(Abstract): ...
class Parent:
others: dict[str, type[Abstract]]
class Child(Parent):
others = {"abstract": Unimplemented} # E: Only concrete class can be given where "tuple[str, type[Abstract]]" is expected [type-abstract]
Expected Behavior
Reports the error message with "dict[str, type[Abstract]]".
Your Environment
- Mypy version used: 1.10
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.10, 3.12
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.
Research direction
Start with the linked mypy Playground reproduction under Python 3.12 and strict mode, then trace the source of the [type-abstract] diagnostic and its displayed inferred type. Done means the same example reports dict[str, type[Abstract]] rather than tuple[str, type[Abstract]], with behavior checked against the stated Python versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100