From 7bae3b75902a14108fa2b3e0d30e6ff0fc016caa Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Mon, 23 Mar 2026 19:22:08 +0100 Subject: [PATCH] ENH: allow copy= in from_dlpack --- array_api_strict/_creation_functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/array_api_strict/_creation_functions.py b/array_api_strict/_creation_functions.py index af4fa6e..8d3dc60 100644 --- a/array_api_strict/_creation_functions.py +++ b/array_api_strict/_creation_functions.py @@ -212,15 +212,15 @@ def from_dlpack( if copy is not _undef: raise ValueError("The copy argument to from_dlpack requires at least version 2023.12 of the array API") - # Going to wait for upstream numpy support if device is not _undef: _check_device(device) else: device = None - if copy not in [_undef, None]: - raise NotImplementedError("The copy argument to from_dlpack is not yet implemented") + if copy in [_undef, None]: + # numpy 1.26 does not have the copy= arg + return Array._new(np.from_dlpack(x), device=device) - return Array._new(np.from_dlpack(x), device=device) + return Array._new(np.from_dlpack(x, copy=copy), device=device) def full(