summaryrefslogtreecommitdiff
path: root/numpy/_array_api/_creation_functions.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/_array_api/_creation_functions.py')
-rw-r--r--numpy/_array_api/_creation_functions.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/_array_api/_creation_functions.py b/numpy/_array_api/_creation_functions.py
index 1d8c5499a..0c39a5875 100644
--- a/numpy/_array_api/_creation_functions.py
+++ b/numpy/_array_api/_creation_functions.py
@@ -33,10 +33,12 @@ def asarray(obj: Union[Array, bool, int, float, NestedSequence[bool|int|float],
_check_valid_dtype(dtype)
if device not in ['cpu', None]:
raise ValueError(f"Unsupported device {device!r}")
- if copy is not None:
- # Note: copy is not yet implemented in np.asarray
- raise NotImplementedError("The copy keyword argument to asarray is not yet implemented")
+ if copy is False:
+ # Note: copy=False is not yet implemented in np.asarray
+ raise NotImplementedError("copy=False is not yet implemented")
if isinstance(obj, Array) and (dtype is None or obj.dtype == dtype):
+ if copy is True:
+ return Array._new(np.array(obj._array, copy=True, dtype=dtype))
return obj
if dtype is None and isinstance(obj, int) and (obj > 2**64 or obj < -2**63):
# Give a better error message in this case. NumPy would convert this