Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sagemathgh-38683: Fix matrix coercion with numpy 2.1
numpy 2.1 requires a `copy` argument for `numpy.array`. Fixes test failures with numpy 2.1: ``` ********************************************************************** File "/usr/lib/python3.12/site-packages/sage/matrix/matrix1.pyx", line 723, in sage.matrix.matrix1.Matrix.numpy Failed example: b = numpy.array(a); b Exception raised: Traceback (most recent call last): File "/usr/lib/python3.12/site-packages/sage/doctest/forker.py", line 716, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/lib/python3.12/site-packages/sage/doctest/forker.py", line 1146, in compile_and_execute exec(compiled, globs) File "<doctest sage.matrix.matrix1.Matrix.numpy[9]>", line 1, in <module> b = numpy.array(a); b ^^^^^^^^^^^^^^ File "sage/matrix/matrix1.pyx", line 673, in sage.matrix.matrix1.Matrix.numpy (build/cythonized/sage/matrix/matrix1.c:14076) def numpy(self, dtype=None): TypeError: numpy() got an unexpected keyword argument 'copy' ********************************************************************** File "/usr/lib/python3.12/site-packages/sage/matrix/matrix1.pyx", line 727, in sage.matrix.matrix1.Matrix.numpy Failed example: b.dtype Exception raised: Traceback (most recent call last): File "/usr/lib/python3.12/site-packages/sage/doctest/forker.py", line 716, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/lib/python3.12/site-packages/sage/doctest/forker.py", line 1146, in compile_and_execute exec(compiled, globs) File "<doctest sage.matrix.matrix1.Matrix.numpy[10]>", line 1, in <module> b.dtype ^ NameError: name 'b' is not defined ********************************************************************** File "/usr/lib/python3.12/site-packages/sage/matrix/matrix1.pyx", line 730, in sage.matrix.matrix1.Matrix.numpy Failed example: b.shape Exception raised: Traceback (most recent call last): File "/usr/lib/python3.12/site-packages/sage/doctest/forker.py", line 716, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/lib/python3.12/site-packages/sage/doctest/forker.py", line 1146, in compile_and_execute exec(compiled, globs) File "<doctest sage.matrix.matrix1.Matrix.numpy[11]>", line 1, in <module> b.shape ^ NameError: name 'b' is not defined ********************************************************************** ``` URL: sagemath#38683 Reported by: Antonio Rojas Reviewer(s): François Bissey
- Loading branch information