This repository was archived by the owner on Jun 10, 2020. It is now read-only.
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
Unsigned int constructors too generous #72
Closed
Description
xref #70
The code
import numpy as np
class A:
def __float__(self):
return 4.0
np.uint8(A())
fails at runtime, but passes type checking. The reason is here:
https://github.com/numpy/numpy-stubs/blob/master/numpy-stubs/__init__.pyi#L402
where the constructor of number
is:
class number(generic):
def __init__(self, value: Union[SupportsInt, SupportsFloat] = ...) -> None: ...