Skip to content

Commit 462ffe2

Browse files
committed
perf: remove a redundant attribute access
1 parent 413137a commit 462ffe2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

numba_cuda/numba/cuda/cudadrv/devicearray.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ def __init__(self, shape, strides, dtype, stream=0, gpu_data=None):
123123

124124
@property
125125
def __cuda_array_interface__(self):
126-
if self.device_ctypes_pointer.value is not None:
127-
ptr = self.device_ctypes_pointer.value
126+
if (value := self.device_ctypes_pointer.value) is not None:
127+
ptr = value
128128
else:
129129
ptr = 0
130130

131131
return {
132-
"shape": tuple(self.shape),
132+
"shape": self.shape,
133133
"strides": None if is_contiguous(self) else tuple(self.strides),
134134
"data": (ptr, False),
135135
"typestr": self.dtype.str,
136-
"stream": int(self.stream) if self.stream != 0 else None,
136+
"stream": int(stream) if (stream := self.stream) != 0 else None,
137137
"version": 3,
138138
}
139139

0 commit comments

Comments
 (0)