Skip to content

Commit dfa8b57

Browse files
authored
Merge branch 'main' into doc_nits
2 parents 1045064 + ddc1f94 commit dfa8b57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cuda_core/cuda/core/experimental/_memoryview.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,21 @@ cdef StridedMemoryView view_as_dlpack(obj, stream_ptr, view=None):
180180
capsule = obj.__dlpack__(
181181
stream=stream_ptr,
182182
max_version=(DLPACK_MAJOR_VERSION, DLPACK_MINOR_VERSION))
183-
versioned = True
184183
except TypeError:
185184
capsule = obj.__dlpack__(
186185
stream=stream_ptr)
187-
versioned = False
188186

189187
cdef void* data = NULL
190-
if versioned and cpython.PyCapsule_IsValid(
188+
if cpython.PyCapsule_IsValid(
191189
capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME):
192190
data = cpython.PyCapsule_GetPointer(
193191
capsule, DLPACK_VERSIONED_TENSOR_UNUSED_NAME)
194-
elif not versioned and cpython.PyCapsule_IsValid(
192+
versioned = True
193+
elif cpython.PyCapsule_IsValid(
195194
capsule, DLPACK_TENSOR_UNUSED_NAME):
196195
data = cpython.PyCapsule_GetPointer(
197196
capsule, DLPACK_TENSOR_UNUSED_NAME)
197+
versioned = False
198198
else:
199199
assert False
200200

0 commit comments

Comments
 (0)