From b67e1a4d36a8927a462c5f33ef552e6fe56445c7 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Sat, 11 Jul 2015 15:47:11 -0500 Subject: [PATCH] Deprecate get() between arrays of different shape --- pyopencl/array.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pyopencl/array.py b/pyopencl/array.py index 241c0ff5..631ca0bc 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: -- GitLab