Skip to content

Commit

Permalink
Define min_size near usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Aug 11, 2020
1 parent 686ff3e commit 55ce3d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ucp/_libs/utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cpdef Py_ssize_t get_buffer_nbytes(buffer, check_min_size, bint cuda_support) ex
)

cdef tuple shape, strides
cdef Py_ssize_t i, s, itemsize, ndim, nbytes, min_size
cdef Py_ssize_t i, s, itemsize, ndim, nbytes
if iface is not None:
import numpy
itemsize = numpy.dtype(iface["typestr"]).itemsize
Expand Down Expand Up @@ -85,6 +85,7 @@ cpdef Py_ssize_t get_buffer_nbytes(buffer, check_min_size, bint cuda_support) ex
if not mview.c_contiguous:
raise ValueError("buffer must be C-contiguous")

cdef Py_ssize_t min_size
if check_min_size is not None:
min_size = check_min_size
if nbytes < min_size:
Expand Down

0 comments on commit 55ce3d2

Please sign in to comment.