Skip to content

Commit bd30f85

Browse files
committed
Improve validation of val for fill method
1 parent e29685e commit bd30f85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dpnp/dpnp_algo/dpnp_fill.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
# THE POSSIBILITY OF SUCH DAMAGE.
2525
# *****************************************************************************
2626

27+
from numbers import Number
28+
2729
import dpctl.tensor as dpt
2830
import dpctl.utils as dpu
2931
from dpctl.tensor._ctors import _cast_fill_val
@@ -58,9 +60,9 @@ def dpnp_fill(arr, val):
5860
)
5961
_manager.add_event_pair(h_ev, c_ev)
6062
return
61-
elif not dpnp.isscalar(val):
63+
elif not isinstance(val, Number):
6264
raise TypeError(
63-
f"Expected `val` to be a 0D-array or Python scalar, got {type(val)}"
65+
f"Array cannot be filled with `val` of type {type(val)}"
6466
)
6567

6668
dt = arr.dtype

0 commit comments

Comments
 (0)