Skip to content

Commit 027cfb8

Browse files
committed
fixup! Fix arguments for ArrayValue.__array__()
1 parent 7f810f8 commit 027cfb8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/JlWrap/array.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,12 @@ function init_array()
365365
except ImportError:
366366
numpy = None
367367
if numpy is not None:
368-
return numpy.array(arr, dtype=dtype, copy=copy)
368+
# Numpy <2 does not support the `copy` argument, so we have to check the version
369+
major_version = int(numpy.__version__.split(".")[0])
370+
if major_version < 2:
371+
return numpy.array(arr, dtype=dtype)
372+
else:
373+
return numpy.array(arr, dtype=dtype, copy=copy)
369374
return arr
370375
def to_numpy(self, dtype=None, copy=True, order="K"):
371376
import numpy

0 commit comments

Comments
 (0)