Skip to content

Commit 73526f3

Browse files
committed
Implement ndarray.__array__ interface method
1 parent 13816bd commit 73526f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dpnp/dpnp_array.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,12 @@ def __and__(self, other):
185185
"""Return ``self&value``."""
186186
return dpnp.bitwise_and(self, other)
187187

188-
# '__array__',
188+
def __array__(self, dtype=None, /, *, copy=None):
189+
raise TypeError(
190+
"Implicit conversion to a NumPy array is not allowed. "
191+
"Please use `.asnumpy()` to construct a NumPy array explicitly."
192+
)
193+
189194
# '__array_finalize__',
190195
# '__array_function__',
191196
# '__array_interface__',

0 commit comments

Comments
 (0)