Skip to content
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
@person142

Description

@person142

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: ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions