diff --git a/pyopencl/array.py b/pyopencl/array.py index 001c63bde326c2405d155753bb35867fbedd3963..4d5334be6a025561c397f748b4cabb531bf928d7 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -1138,6 +1138,8 @@ class Array(object): self.add_event( self._scalar_binop(self, self, other, op="&")) + return self + def __ior__(self, other): common_dtype = _get_common_dtype(self, other, self.queue) @@ -1150,6 +1152,8 @@ class Array(object): self.add_event( self._scalar_binop(self, self, other, op="|")) + return self + def __ixor__(self, other): common_dtype = _get_common_dtype(self, other, self.queue) @@ -1162,6 +1166,8 @@ class Array(object): self.add_event( self._scalar_binop(self, self, other, op="^")) + return self + def _zero_fill(self, queue=None, wait_for=None): queue = queue or self.queue diff --git a/test/test_array.py b/test/test_array.py index d57100858802c3d45880e1b55d7697bfab0564c6..a9c1717014a46b2be41775831a438a74c99a7a7a 100644 --- a/test/test_array.py +++ b/test/test_array.py @@ -552,14 +552,17 @@ def test_bitwise(ctx_factory): for op in [o.iand, o.ior, o.ixor]: res_dev = a_dev.copy() - op(res_dev, b_dev) + op_res = op(res_dev, b_dev) + assert op_res is res_dev + res = a.copy() op(res, b) assert (res_dev.get() == res).all() res_dev = a_dev.copy() - op(res_dev, s) + op_res = op(res_dev, s) + assert op_res is res_dev res = a.copy() op(res, s)