From 69d4acf46c88e8d9d70e48dace94b807854fc24e Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 21 Jun 2015 23:38:17 -0500 Subject: [PATCH] Gate np.getbuffer() workaround to be CPy2-only --- pyopencl/cffi_cl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index fd10db79..7fe18c54 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -42,6 +42,7 @@ from .compyte.array import f_contiguous_strides, c_contiguous_strides # are we running on pypy? _PYPY = '__pypy__' in sys.builtin_module_names +_CPY2 = not _PYPY and sys.version_info < (3,) try: _unicode = eval('unicode') @@ -958,7 +959,7 @@ class Kernel(_Common): elif isinstance(arg, LocalMemory): _handle_error(_lib.kernel__set_arg_buf(self.ptr, arg_index, _ffi.NULL, arg.size)) - elif isinstance(arg, np.generic): + elif _CPY2 and isinstance(arg, np.generic): c_buf, size, _ = _c_buffer_from_obj(np.getbuffer(arg)) _handle_error(_lib.kernel__set_arg_buf(self.ptr, arg_index, c_buf, size)) -- GitLab