diff --git a/pyopencl/array.py b/pyopencl/array.py index e05ba222f640fa35a7bcf9a08b1bedff0d1c0693..03b87209ee715b684be44414f3acea550234a9a0 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -2019,7 +2019,7 @@ class Array: raise ValueError("cannot assign between arrays of " "differing shapes") if subarray.strides != value.strides: - raise ValueError("cannot assign between arrays of " + raise NotImplementedError("cannot assign between arrays of " "differing strides") self.add_event( diff --git a/test/test_array.py b/test/test_array.py index a63e5f3ef78ab0049874213cec9b734fdec62703..d8b0d7bd00fb95dafd2066ee26577b855edb7530 100644 --- a/test/test_array.py +++ b/test/test_array.py @@ -1544,6 +1544,18 @@ def test_stack(ctx_factory, input_dims, order): np.stack((x_in, y_in), axis=axis)) +def test_assign_different_strides(ctx_factory): + cl_ctx = ctx_factory() + queue = cl.CommandQueue(cl_ctx) + + from pyopencl.clrandom import rand as clrand + + a = clrand(queue, (20, 30), dtype=np.float32) + b = cl_array.empty(queue, (20, 30), dtype=np.float32, order="F") + with pytest.raises(NotImplementedError): + b[:] = a + + if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1])