aboutsummaryrefslogtreecommitdiff
blob: eae8aabbdf90b1e8c07ad5c31869d810620a768c (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
diff -Nur Numeric-24.2/Src/arrayobject.c Numeric-24.2.new/Src/arrayobject.c
--- Numeric-24.2/Src/arrayobject.c	2007-05-25 18:34:55.000000000 +0100
+++ Numeric-24.2.new/Src/arrayobject.c	2007-05-25 18:34:04.000000000 +0100
@@ -12,7 +12,7 @@
   performance for heterogeneity.
 */
 
-/* $Id: arrayobject.c,v 1.108 2006/03/10 04:55:59 teoliphant Exp $ */
+/* $Id: arrayobject.c,v 1.107 2005/11/09 19:43:39 teoliphant Exp $ */
 
 #include "Python.h"
 #include <stddef.h>
@@ -491,7 +491,8 @@
 
 static PyObject * PyArray_Resize(PyArrayObject *self, PyObject *shape) {
     size_t oldsize, newsize;
-    int new_nd, k, sd, n, elsize;
+    int sd, n, elsize;
+    Py_ssize_t new_nd, k;
     int refcnt;
     int new_dimensions[MAX_DIMS];
     int new_strides[MAX_DIMS];
@@ -776,7 +777,7 @@
 
     if ((item = index2ptr(self, i)) == NULL) return -1;
 
-    if(self->descr->type_num != PyArray_OBJECT && PyString_Check(v) && PyObject_Length(v) == 1) {
+    if(self->descr->type_num != PyArray_OBJECT && PyString_Check(v) && PyObject_Length(v) == (Py_ssize_t)1) {
 	char *s;
 	if ((s=PyString_AsString(v)) == NULL) return -1;
 	if(self->descr->type == 'c') {
@@ -823,7 +824,7 @@
 
 /* This is basically PySlice_GetIndicesEx, but with our coercion
  * of indices to integers (plus, that function is new in Python 2.3) */
-static int
+static Py_ssize_t
 slice_GetIndices(PySliceObject *r, int length,
                  int *start, int *stop, int *step,
                  int *slicelength)
@@ -925,8 +926,8 @@
 
 static int parse_index(PyArrayObject *self, PyObject *op,
 		       int *dimensions, int *strides, int *offset_ptr) {
-    int i, j, n;
-    int nd_old, nd_new, start, offset, n_add, n_pseudo;
+    Py_ssize_t i, n, j, n_add, n_pseudo;
+    int nd_old, nd_new, start, offset;
     int step_size, n_steps;
     PyObject *op1=NULL;
     int is_slice;
@@ -1098,7 +1099,7 @@
 }
 
 static PyMappingMethods array_as_mapping = {
-    (inquiry)array_length,		/*mp_length*/
+    (lenfunc)array_length,		/*mp_length*/
     (binaryfunc)array_subscript_nice,   /*mp_subscript*/
     (objobjargproc)array_ass_sub,	/*mp_ass_subscript*/
 };
@@ -1183,10 +1184,10 @@
 }
 
 static PyBufferProcs array_as_buffer = {
-    (getreadbufferproc)array_getreadbuf,    /*bf_getreadbuffer*/
-    (getwritebufferproc)array_getwritebuf,  /*bf_getwritebuffer*/
-    (getsegcountproc)array_getsegcount,     /*bf_getsegcount*/
-    (getcharbufferproc)array_getcharbuf,    /*bf_getcharbuffer*/
+    (readbufferproc)array_getreadbuf,    /*bf_getreadbuffer*/
+    (writebufferproc)array_getwritebuf,  /*bf_getwritebuffer*/
+    (segcountproc)array_getsegcount,     /*bf_getsegcount*/
+    (charbufferproc)array_getcharbuf,    /*bf_getcharbuffer*/
 };
 /* End methods added by Scott N. Gunyan for buffer extension */
 
@@ -1595,7 +1596,7 @@
     (unaryfunc)array_negative,
     (unaryfunc)PyArray_Copy,                /*nb_pos*/
     (unaryfunc)array_absolute,              /*(unaryfunc)array_abs,*/
-    (inquiry)array_nonzero,                 /*nb_nonzero*/
+    (lenfunc)array_nonzero,                 /*nb_nonzero*/
     (unaryfunc)array_invert,                /*nb_invert*/
     (binaryfunc)array_left_shift,           /*nb_lshift*/
     (binaryfunc)array_right_shift,          /*nb_rshift*/
@@ -1634,13 +1635,13 @@
 };
 
 static PySequenceMethods array_as_sequence = {
-    (inquiry)array_length,		/*sq_length*/
+    (lenfunc)array_length,		/*sq_length*/
     (binaryfunc)NULL, /*nb_add, concat is numeric add*/
-    (intargfunc)NULL, /*nb_multiply, repeat is numeric multiply*/
-    (intargfunc)array_item_nice,	/*sq_item*/
-    (intintargfunc)array_slice,		/*sq_slice*/
-    (intobjargproc)array_ass_item,	/*sq_ass_item*/
-    (intintobjargproc)array_ass_slice,	/*sq_ass_slice*/
+    (ssizeargfunc)NULL, /*nb_multiply, repeat is numeric multiply*/
+    (ssizeargfunc)array_item_nice,	/*sq_item*/
+    (ssizessizeargfunc)array_slice,		/*sq_slice*/
+    (ssizeobjargproc)array_ass_item,	/*sq_ass_item*/
+    (ssizessizeobjargproc)array_ass_slice,	/*sq_ass_slice*/
 };
 
 /* -------------------------------------------------------------- */
@@ -2426,7 +2427,7 @@
 
 #if PY_VERSION_HEX >= 0x02010000
     (traverseproc)0L,
-    (inquiry)0L,
+    (lenfunc)0L,
     (richcmpfunc)array_richcompare,       /*tp_richcompfunc*/
     offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */
 #endif
@@ -2463,7 +2464,8 @@
 
 static int discover_dimensions(PyObject *s, int nd, int *d, int check_it) {
     PyObject *e;
-    int r, n, i, n_lower;
+    int r, n_lower;
+    Py_ssize_t i, n;
 
     n=PyObject_Length(s);
     *d = n;
@@ -2501,7 +2503,7 @@
 static int
 array_objecttype(PyObject *op, int minimum_type, int savespaceflag, int max)
 {
-    int l;
+    Py_ssize_t l;
     PyObject *ip;
     int result;
     PyArray_Descr* descr;
@@ -2593,7 +2595,9 @@
 
 static int Assign_Array(PyArrayObject *self, PyObject *v) {
     PyObject *e;
-    int l, r;
+    int r;
+    Py_ssize_t l;
+
 
     if (!PySequence_Check(v)) {
 	PyErr_SetString(PyExc_ValueError,"assignment from non-sequence");
diff -Nur Numeric-24.2/Src/multiarraymodule.c Numeric-24.2.new/Src/multiarraymodule.c
--- Numeric-24.2/Src/multiarraymodule.c	2005-08-16 06:20:25.000000000 +0100
+++ Numeric-24.2.new/Src/multiarraymodule.c	2007-05-25 18:28:35.000000000 +0100
@@ -36,7 +36,8 @@
 extern PyObject *PyArray_Concatenate(PyObject *op) {
     PyArrayObject *ret, **mps;
     PyObject *otmp;
-    int i, n, type_num, tmp, nd=0, new_dim;
+    int type_num, tmp, nd=0, new_dim;
+    Py_ssize_t i, n;
     char *data;
 
     n = PySequence_Length(op);
@@ -284,7 +285,8 @@
 
 
 extern PyObject *PyArray_Choose(PyObject *ip, PyObject *op) {
-    int i, n, *sizes, m, offset, elsize, type_num;
+    int *sizes, elsize, type_num;
+    Py_ssize_t i, n, m, offset;
     char *ret_data;
     PyArrayObject **mps, *ap, *ret;
     PyObject *otmp;
@@ -1139,7 +1141,8 @@
     static char *kwlist[] = {"shape", "typecode", "savespace", NULL};
     PyObject *op;
     PyArray_Descr *descr;
-    int i, nd, n, dims[MAX_DIMS];
+    int dims[MAX_DIMS];
+    Py_ssize_t i, nd, n;
     int sd;
     char *data;
 
@@ -1217,7 +1220,8 @@
     PyArrayObject *ret;
     char type_char='l';
     char *type = &type_char, *dptr;
-    int i, nd, n, dimensions[MAX_DIMS];
+    int dimensions[MAX_DIMS];
+    Py_ssize_t i, nd, n;
     int savespace=0;
     static char all_zero[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
     static char *kwlist[] = {"shape", "typecode", "savespace", NULL};
diff -Nur Numeric-24.2/Src/ufuncobject.c Numeric-24.2.new/Src/ufuncobject.c
--- Numeric-24.2/Src/ufuncobject.c	2005-08-16 06:20:25.000000000 +0100
+++ Numeric-24.2.new/Src/ufuncobject.c	2007-05-25 18:28:35.000000000 +0100
@@ -272,7 +272,7 @@
 
 int setup_matrices(PyUFuncObject *self, PyObject *args,  PyUFuncGenericFunction *function, void **data,
 		   PyArrayObject **mps, char *arg_types) {
-    int nargs, i;
+    Py_ssize_t nargs, i;
 
     nargs = PyTuple_Size(args);
     if ((nargs != self->nin) && (nargs != self->nin+self->nout)) {