Commit 3c218baf authored by Stefan Behnel's avatar Stefan Behnel

Use explicit integer division in generated Cython utility code.

parent 22ddeca8
......@@ -177,7 +177,7 @@ cdef class array:
if self.dtype_is_object:
p = <PyObject **> self.data
for i in range(self.len / itemsize):
for i in range(self.len // itemsize):
p[i] = Py_None
Py_INCREF(Py_None)
......@@ -866,7 +866,7 @@ cdef int slice_memviewslice(
if not have_step:
step = 1
# len = ceil( (stop - start) / step )
# len = ceil( (stop - start) // step )
with cython.cdivision(True):
new_shape = (stop - start) // step
......@@ -910,7 +910,7 @@ cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
cdef char *resultp
if view.ndim == 0:
shape = view.len / itemsize
shape = view.len // itemsize
stride = itemsize
else:
shape = view.shape[dim]
......@@ -944,7 +944,7 @@ cdef int transpose_memslice({{memviewslice_name}} *memslice) nogil except 0:
# reverse strides and shape
cdef int i, j
for i in range(ndim / 2):
for i in range(ndim // 2):
j = ndim - 1 - i
strides[i], strides[j] = strides[j], strides[i]
shape[i], shape[j] = shape[j], shape[i]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment