8000 MAINT: Fix issue 77: Don't allow initializing `generic` by BvB93 · Pull Request #80 · numpy/numpy-stubs · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
8000

MAINT: Fix issue 77: Don't allow initializing generic #80

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FIXED: np.void also accepts booleans
  • Loading branch information
Bas van Beek committed Jun 5, 2020
commit ee18c3330d37a784eb352269b99b2849cd0262a8
2 changes: 1 addition & 1 deletion numpy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class complex128(complexfloating):
class flexible(_real_generic, metaclass=ABCMeta): ...

class void(flexible):
def __init__(self, value: Union[int, integer, bytes, bytes_]): ...
def __init__(self, value: Union[int, integer, bool_, bytes, bytes_]): ...

class character(_real_generic, metaclass=ABCMeta): ...

Expand Down
2 changes: 2 additions & 0 deletions tests/pass/scalars.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@ def __float__(self):

np.void(1)
np.void(np.int64(1))
np.void(True)
np.void(np.bool_(True))
np.void(b"test")
np.void(np.bytes_("test"))
0