From ac7ed3c9aa3e47a6ff685542c806445704a71c4f Mon Sep 17 00:00:00 2001 From: Marko Bencun <mbencun@gmail.com> Date: Wed, 11 Sep 2013 15:41:51 +0200 Subject: [PATCH] fixed one test where the buffer is allowed to be None --- pyopencl/cffi_cl.py | 7 +++++-- test/test_wrapper.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index b9e8dc25..35481c88 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -1,4 +1,4 @@ -#from pyopencl._cl import PooledBuffer, MemoryPool +from pyopencl._cl import PooledBuffer, MemoryPool import warnings import np import ctypes @@ -697,7 +697,10 @@ class Image(MemoryObject): if shape is None: raise LogicError("Image", status_code.INVALID_VALUE, "'shape' must be given") - c_buf, size, _ = _c_buffer_from_obj(buffer, writable=flags & mem_flags.USE_HOST_PTR) + if buffer is None: + c_buf, size = _ffi.NULL, 0 + else: + c_buf, size, _ = _c_buffer_from_obj(buffer, writable=flags & mem_flags.USE_HOST_PTR) dims = len(shape) if dims == 2: diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 3a7a52d9..8b1db5af 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -47,10 +47,13 @@ def test_get_info(ctx_factory): failure_count = [0] pocl_quirks = [ - (cl.Buffer, cl.mem_info.OFFSET), + (cl.Buffer, cl.mem_info.OFFSET), + ] + if ctx._get_cl_version() >= (1, 2) and cl.get_cl_header_version() >= (1, 2): + pocl_quirks.extend([ (cl.Program, cl.program_info.KERNEL_NAMES), (cl.Program, cl.program_info.NUM_KERNELS), - ] + ]) CRASH_QUIRKS = [ (("NVIDIA Corporation", "NVIDIA CUDA", "OpenCL 1.0 CUDA 3.0.1"), -- GitLab