From c50765f34481b396d88b192ecd2e80e58f3bec32 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 20 Aug 2018 14:52:34 -0500 Subject: [PATCH] [pybind] Pypy compat tweaks --- pyopencl/array.py | 3 ++- src/wrap_cl.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyopencl/array.py b/pyopencl/array.py index 704c495b..a4a5f4cf 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 81ff64a3..b4d16831 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 -- GitLab