diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index b9e8dc252635e4b0c4bfe10a71bdee8483cbab52..35481c8804ccf490c0e8c781eb28d823b661ed6b 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 3a7a52d9be6edf848e16fa4affa7b767bbd0e8d5..8b1db5afa6fd3dba00c8189ac496384ef8b5664d 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"),