Skip to content

Commit 05ade67

Browse files
committed
Fix clipping float with python int for min and max
1 parent e14754b commit 05ade67

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

array_api_compat/common/_aliases.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,11 @@ def _isscalar(a):
363363

364364
# At least handle the case of Python integers correctly (see
365365
# https://github.com/numpy/numpy/pull/26892).
366-
if type(min) is int and min <= wrapped_xp.iinfo(x.dtype).min:
367-
min = None
368-
if type(max) is int and max >= wrapped_xp.iinfo(x.dtype).max:
369-
max = None
366+
if wrapped_xp.isdtype(x.dtype, "integral"):
367+
if type(min) is int and min <= wrapped_xp.iinfo(x.dtype).min:
368+
min = None
369+
if type(max) is int and max >= wrapped_xp.iinfo(x.dtype).max:
370+
max = None
370371

371372
dev = device(x)
372373
if out is None:

0 commit comments

Comments
 (0)