1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
--- Src/_ndarraymodule.c.orig 2007-09-05 09:54:58.759967037 +0100
+++ Src/_ndarraymodule.c 2007-09-05 09:54:36.098675644 +0100
@@ -596,12 +596,12 @@
/* Copied from Python-2.3.3 Objects/sliceobject.c */
int
-_GetIndicesEx(PySliceObject *r, int length,
- int *start, int *stop, int *step, int *slicelength)
+_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
+ Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength)
{
/* this is harder to get right than you might think */
- int defstart, defstop;
+ Py_ssize_t defstart, defstop;
if (r->step == Py_None) {
*step = 1;
@@ -706,7 +706,7 @@
self->nd = _snip( self->nd, self->dimensions, dim);
self->nstrides = _snip( self->nstrides, self->strides, dim);
} else if (PySlice_Check(slice)) {
- int start, stop, step, strided;
+ Py_ssize_t start, stop, step, strided;
if (_GetIndicesEx( (PySliceObject *) slice,
self->dimensions[dim],
&start, &stop, &step, &strided) < 0)
@@ -718,9 +718,9 @@
Py_INCREF(Py_None);
return Py_None;
}
- self->byteoffset += self->strides[dim] * start;
- self->dimensions[dim] = strided;
- self->strides[dim] *= step;
+ self->byteoffset += (maybelong) (self->strides[dim] * start);
+ self->dimensions[dim] = (maybelong) strided;
+ self->strides[dim] *= (maybelong) step;
++ dim;
} else {
Py_DECREF(rest);
|