Support __call__ on metaclasses
Open
Nobody has claimed this yet.
bug
priority-2-low
topic-protocols
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Currently we don't handle __call__() on metaclasses correctly. For example:
class M(type):
def __call__(self, x: int) -> Any: ...
class C(metaclass=M): ...
C(x=1)
results in a false positive. Also similarly handling of metaclass __call__() in protocols is not very principled, see e.g. https://github.com/python/mypy/pull/14121
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 by reproducing the metaclass example in the issue and inspect the related protocol discussion in pull request 14121. Trace how metaclass call signatures are handled for ordinary classes and protocols. Done means the example no longer produces a false positive and protocol handling follows a consistent rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100