diff --git a/pyopencl/array.py b/pyopencl/array.py index 241c0ff59e843a79bedb9532053c3f13d933563f..631ca0bc108bee39413ccc0b95ae895bd287f10c 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -665,8 +665,12 @@ class Array(object): def get(self, queue=None, ary=None, async=False): """Transfer the contents of *self* into *ary* or a newly allocated - :mod:`numpy.ndarray`. If *ary* is given, it must have the right - size (not necessarily shape) and dtype. + :mod:`numpy.ndarray`. If *ary* is given, it must have the same + shape and dtype. + + .. versionchanged:: 2015.2 + + *ary* with different shape was deprecated. """ if ary is None: @@ -679,6 +683,13 @@ class Array(object): if ary.dtype != self.dtype: raise TypeError("'ary' has non-matching type") + if self.shape != ary.shape: + from warnings import warn + warn("get() between arrays of different shape is deprecated " + "and will be removed in PyCUDA 2017.x", + DeprecationWarning, stacklevel=2) + + assert self.flags.forc, "Array in get() must be contiguous" if self.size: