-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
Bug Report
This came up with pandas-stubs, but can reproduce with just numpy
To Reproduce
from typing import TypeVar
import numpy as np
NDArrayT = TypeVar("NDArrayT", bound=np.ndarray)
def foo(x: type[NDArrayT]) -> NDArrayT:
return x([1, 2])
reveal_type(foo(np.ndarray))Expected Behavior
Revealed type should be ndarray[tuple[Any, ...], dtype[Any]], which is what pyright reports.
Actual Behavior
mypy reports numpy.ndarray[Any, Any]
Your Environment
- Mypy version used: 1.19.0
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.11
- numpy version: 2.3.5
- pyright version: 1.1.407
jorenham