Fix ndarray initialization bug
@@ -121,8 +121,9 @@ cdef class ndarray:
def __init__(self, shape, dtype=float, memptr=None, strides=None,
order='C'):
cdef Py_ssize_t x, itemsize
- cdef tuple s = internal.get_size(shape)
+ cdef vector.vector[Py_ssize_t] s = internal.get_size(shape)
cdef int order_char = 'C' if order is None else _normalize_order(order)
+ del shape
# `strides` is prioritized over `order`, but invalid `order` should be
# checked even if `strides` is given.
@@ -141,7 +142,7 @@ cdef class ndarray:
if strides is not None:
if memptr is None:
raise ValueError('memptr is required if strides is given.')
- self._set_shape_and_strides(shape, strides, True, True)
+ self._set_shape_and_strides(s, strides, True, True)
elif order_char == 'C':
self._set_shape_and_contiguous_strides(s, itemsize, True)
elif order_char == 'F':
