Lines 592-599
_ndarray_simpleIndexing(PyArrayObject *s
Link Here
|
592 |
|
592 |
|
593 |
/* Copied from Python-2.3.3 Objects/sliceobject.c */ |
593 |
/* Copied from Python-2.3.3 Objects/sliceobject.c */ |
594 |
int |
594 |
int |
595 |
_GetIndicesEx(PySliceObject *r, int length, |
595 |
_GetIndicesEx(PySliceObject *r, Py_ssize_t length, |
596 |
int *start, int *stop, int *step, int *slicelength) |
596 |
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) |
597 |
{ |
597 |
{ |
598 |
/* this is harder to get right than you might think */ |
598 |
/* this is harder to get right than you might think */ |
599 |
|
599 |
|
Lines 702-708
_slicedIndexing0(PyArrayObject *self, Py
Link Here
|
702 |
self->nd = _snip( self->nd, self->dimensions, dim); |
702 |
self->nd = _snip( self->nd, self->dimensions, dim); |
703 |
self->nstrides = _snip( self->nstrides, self->strides, dim); |
703 |
self->nstrides = _snip( self->nstrides, self->strides, dim); |
704 |
} else if (PySlice_Check(slice)) { |
704 |
} else if (PySlice_Check(slice)) { |
705 |
int start, stop, step, strided; |
705 |
Py_ssize_t start, stop, step, strided; |
706 |
if (_GetIndicesEx( (PySliceObject *) slice, |
706 |
if (_GetIndicesEx( (PySliceObject *) slice, |
707 |
self->dimensions[dim], |
707 |
self->dimensions[dim], |
708 |
&start, &stop, &step, &strided) < 0) |
708 |
&start, &stop, &step, &strided) < 0) |
Lines 714-722
_slicedIndexing0(PyArrayObject *self, Py
Link Here
|
714 |
Py_INCREF(Py_None); |
714 |
Py_INCREF(Py_None); |
715 |
return Py_None; |
715 |
return Py_None; |
716 |
} |
716 |
} |
717 |
self->byteoffset += self->strides[dim] * start; |
717 |
self->byteoffset += (maybelong) (self->strides[dim] * start); |
718 |
self->dimensions[dim] = strided; |
718 |
self->dimensions[dim] = (maybelong) strided; |
719 |
self->strides[dim] *= step; |
719 |
self->strides[dim] *= (maybelong) step; |
720 |
++ dim; |
720 |
++ dim; |
721 |
} else { |
721 |
} else { |
722 |
Py_DECREF(rest); |
722 |
Py_DECREF(rest); |