To Reproduce
In _mypy/_1.py:
class spam:
def __class_getitem__(cls, _, /): return cls
In _mypy/_1.pyi:
Expected Behavior
Stubtest should not report any errors. The class is implemented to be generic since a __class_getitem__ method is provided, and type-checked to be generic from the type parameter syntax.
Actual Behavior
error: _mypy._1.spam.__class_getitem__ is not present in stub
Stub: in file /_mypy/_1.pyi
MISSING
Runtime: in file /_mypy/_1.py:2
def (_, /)
Your Environment
- Mypy version used: 1.20.0
- Command used: python -m mypy.stubtest _mypy
- Python version used: 3.14
To Reproduce
In
_mypy/_1.py:In
_mypy/_1.pyi:Expected Behavior
Stubtest should not report any errors. The class is implemented to be generic since a
__class_getitem__method is provided, and type-checked to be generic from the type parameter syntax.Actual Behavior
Your Environment