Skip to content
Snippets Groups Projects
Commit c2c0f6cb authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Catch negative-size array allocations

parent e728dc15
No related branches found
No related tags found
No related merge requests found
......@@ -481,9 +481,14 @@ class Array(object):
self.allocator = allocator
if data is None:
if not alloc_nbytes:
# Work around CL not allowing zero-sized buffers.
alloc_nbytes = 1
if alloc_nbytes <= 0:
if alloc_nbytes == 0:
# Work around CL not allowing zero-sized buffers.
alloc_nbytes = 1
else:
raise ValueError("cannot allocate CL buffer with "
"negative size")
if allocator is None:
if context is None and queue is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment