diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index 8d2510e60267a73a786120cd87e5784a64109e58..58a2e014b5c7d4d0395fede3289d6a1960d7db28 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -453,7 +453,7 @@ def _c_buffer_from_obj(obj, writable=False): obj.__array_interface__['data'][0]), obj.nbytes, None) - if isinstance(obj, np.generic): + elif isinstance(obj, np.generic): # numpy scalar # # * obj.__array_interface__ exists in CPython, but the address does @@ -467,6 +467,10 @@ def _c_buffer_from_obj(obj, writable=False): s_array.__array_interface__['data'][0]), s_array.nbytes, s_array) + elif isinstance(obj, bytes): + # There sould be better ways to pass arguments + p = _ffi.new('char[]', obj) + return (_ffi.cast('void *', p), len(obj), p) else: raise LogicError("", status_code.INVALID_VALUE, "PyOpencl on PyPy only accepts numpy arrays "