Reproducing code example:
# example.py
import numpy as np
def f(x: bool) -> bool:
return x
y = np.bool_(True)
print(f(y))
yields
$ mypy example.py
example.py:9: error: Argument 1 to "f" has incompatible type "bool_"; expected "bool"
Found 1 error in 1 file (checked 1 source file)
The same happens for the inverse:
# example.py
import numpy as np
def f(x: np.bool_) -> np.bool_:
return x
y = True
print(f(y))
results in
example.py:9: error: Argument 1 to "f" has incompatible type "bool"; expected "bool_"
np.float_ and np.int_ work fine.
NumPy/Python version information:
1.20.2 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27)
[GCC 9.3.0]
Reproducing code example:
yields
The same happens for the inverse:
results in
np.float_andnp.int_work fine.NumPy/Python version information: