Skip to content

Commit

Permalink
Fix error when decoding a NULL string
Browse files Browse the repository at this point in the history
If some device info is NULL  then this line would cause a RuntimeError: cannot use string() on <cdata 'char *' NULL>.

For example, in my PC, the Intel CPU runtime under Linux has BUILT_IN_KERNELS = NULL.
  • Loading branch information
jcarrano-robot committed Sep 7, 2016
1 parent 3128eb2 commit b1f9f04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyopencl/cffi_cl.py
Expand Up @@ -99,7 +99,7 @@ def _py_call(handle, status):
_bytes = bytes

def _ffi_pystr(s):
return _ffi.string(s).decode()
return _ffi.string(s).decode() if s else None
else:
try:
_bytes = bytes
Expand Down

0 comments on commit b1f9f04

Please sign in to comment.