diff --git a/pyopencl/array.py b/pyopencl/array.py index 704c495b4bff7ceed3d4808244a8bdb844f267b5..a4a5f4cffa57a314192878aec926f99285954b78 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -663,7 +663,8 @@ class Array(object): if ary is None: ary = np.empty(self.shape, self.dtype) - ary = _as_strided(ary, strides=self.strides) + if self.strides != ary.strides: + ary = _as_strided(ary, strides=self.strides) else: if ary.size != self.size: raise TypeError("'ary' has non-matching size") diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp index 81ff64a3b3c5f7e810bec2dccc1b992373185d5f..b4d168314493a05815bbe90f76bd350d25f1e60b 100644 --- a/src/wrap_cl.hpp +++ b/src/wrap_cl.hpp @@ -82,7 +82,7 @@ #endif -#if PY_VERSION_HEX >= 0x03000000 +#if (PY_VERSION_HEX >= 0x03000000) or defined(PYPY_VERSION) #define PYOPENCL_USE_NEW_BUFFER_INTERFACE #define PYOPENCL_STD_MOVE_IF_NEW_BUF_INTF(s) std::move(s) #else