diff --git a/pyopencl/array.py b/pyopencl/array.py index 8d84bb4aa7f7f8763adce01032b363ba2f49de31..bf8325c23a1f463d8c31f565ec9ef1163268e0f9 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -303,7 +303,9 @@ class Array(object): self.base = base - self.context = self.data.context + @property + def context(self): + return self.data.context @property @memoize_method @@ -820,12 +822,14 @@ def to_device(*args, **kwargs): """Converts a numpy array to a :class:`Array`.""" def _to_device(queue, ary, allocator=None, async=False): + if ary.dtype == object: + raise RuntimeError("to_device does not work on object arrays.") + result = Array(queue, ary.shape, ary.dtype, allocator=allocator, strides=ary.strides) result.set(ary, async=async) return result - if isinstance(args[0], cl.Context): from warnings import warn warn("Passing a context as first argument is deprecated. "