Skip to content

Commit

Permalink
Prevent getting np.int
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed Mar 6, 2023
1 parent 717ad31 commit 4f9ca2b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lab/types.py
Expand Up @@ -355,7 +355,12 @@ def dtype_int(dtype: DType):
name = list(convert(dtype, NPDType).__name__)
while name and name[0] not in set([str(i) for i in range(10)]):
name.pop(0)
return _convert_back(getattr(np, "int" + "".join(name)), dtype)
name_int = "int" + "".join(name)
if name_int == "int":
dtype_int = int
else:
dtype_int = getattr(np, name_int)
return _convert_back(dtype_int, dtype)


@dispatch
Expand Down

0 comments on commit 4f9ca2b

Please sign in to comment.