@@ -12,47 +12,47 @@ NPY_NO_EXPORT int PyUFunc_RegisterLoopForType \
12
12
NPY_NO_EXPORT int PyUFunc_GenericFunction \
13
13
(PyUFuncObject * , PyObject * , PyObject * , PyArrayObject * * );
14
14
NPY_NO_EXPORT void PyUFunc_f_f_As_d_d \
15
- (char * * , npy_intp const * , npy_intp const * , void * );
15
+ (char * * , npy_intp * , npy_intp * , void * );
16
16
NPY_NO_EXPORT void PyUFunc_d_d \
17
- (char * * , npy_intp const * , npy_intp const * , void * );
17
+ (char * * , npy_intp * , npy_intp * , void * );
18
18
NPY_NO_EXPORT void PyUFunc_f_f \
19
- (char * * , npy_intp const * , npy_intp const * , void * );
19
+ (char * * , npy_intp * , npy_intp * , void * );
20
20
NPY_NO_EXPORT void PyUFunc_g_g \
21
- (char * * , npy_intp const * , npy_intp const * , void * );
21
+ (char * * , npy_intp * , npy_intp * , void * );
22
22
NPY_NO_EXPORT void PyUFunc_F_F_As_D_D \
23
- (char * * , npy_intp const * , npy_intp const * , void * );
23
+ (char * * , npy_intp * , npy_intp * , void * );
24
24
NPY_NO_EXPORT void PyUFunc_F_F \
25
- (char * * , npy_intp const * , npy_intp const * , void * );
25
+ (char * * , npy_intp * , npy_intp * , void * );
26
26
NPY_NO_EXPORT void PyUFunc_D_D \
27
- (char * * , npy_intp const * , npy_intp const * , void * );
27
+ (char * * , npy_intp * , npy_intp * , void * );
28
28
NPY_NO_EXPORT void PyUFunc_G_G \
29
- (char * * , npy_intp const * , npy_intp const * , void * );
29
+ (char * * , npy_intp * , npy_intp * , void * );
30
30
NPY_NO_EXPORT void PyUFunc_O_O \
31
- (char * * , npy_intp const * , npy_intp const * , void * );
31
+ (char * * , npy_intp * , npy_intp * , void * );
32
32
NPY_NO_EXPORT void PyUFunc_ff_f_As_dd_d \
33
- (char * * , npy_intp const * , npy_intp const * , void * );
33
+ (char * * , npy_intp * , npy_intp * , void * );
34
34
NPY_NO_EXPORT void PyUFunc_ff_f \
35
- (char * * , npy_intp const * , npy_intp const * , void * );
35
+ (char * * , npy_intp * , npy_intp * , void * );
36
36
NPY_NO_EXPORT void PyUFunc_dd_d \
37
- (char * * , npy_intp const * , npy_intp const * , void * );
37
+ (char * * , npy_intp * , npy_intp * , void * );
38
38
NPY_NO_EXPORT void PyUFunc_gg_g \
39
- (char * * , npy_intp const * , npy_intp const * , void * );
39
+ (char * * , npy_intp * , npy_intp * , void * );
40
40
NPY_NO_EXPORT void PyUFunc_FF_F_As_DD_D \
41
- (char * * , npy_intp const * , npy_intp const * , void * );
41
+ (char * * , npy_intp * , npy_intp * , void * );
42
42
NPY_NO_EXPORT void PyUFunc_DD_D \
43
- (char * * , npy_intp const * , npy_intp const * , void * );
43
+ (char * * , npy_intp * , npy_intp * , void * );
44
44
NPY_NO_EXPORT void PyUFunc_FF_F \
45
- (char * * , npy_intp const * , npy_intp const * , void * );
45
+ (char * * , npy_intp * , npy_intp * , void * );
46
46
NPY_NO_EXPORT void PyUFunc_GG_G \
47
- (char * * , npy_intp const * , npy_intp const * , void * );
47
+ (char * * , npy_intp * , npy_intp * , void * );
48
48
NPY_NO_EXPORT void PyUFunc_OO_O \
49
- (char * * , npy_intp const * , npy_intp const * , void * );
49
+ (char * * , npy_intp * , npy_intp * , void * );
50
50
NPY_NO_EXPORT void PyUFunc_O_O_method \
51
- (char * * , npy_intp const * , npy_intp const * , void * );
51
+ (char * * , npy_intp * , npy_intp * , void * );
52
52
NPY_NO_EXPORT void PyUFunc_OO_O_method \
53
- (char * * , npy_intp const * , npy_intp const * , void * );
53
+ (char * * , npy_intp * , npy_intp * , void * );
54
54
NPY_NO_EXPORT void PyUFunc_On_Om \
55
- (char * * , npy_intp const * , npy_intp const * , void * );
55
+ (char * * , npy_intp * , npy_intp * , void * );
56
56
NPY_NO_EXPORT int PyUFunc_GetPyValues \
57
57
(char * , int * , int * , PyObject * * );
58
58
NPY_NO_EXPORT int PyUFunc_checkfperr \
@@ -70,17 +70,17 @@ NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignature \
70
70
NPY_NO_EXPORT int PyUFunc_SetUsesArraysAsData \
71
71
(void * * , size_t );
72
72
NPY_NO_EXPORT void PyUFunc_e_e \
73
- (char * * , npy_intp const * , npy_intp const * , void * );
73
+ (char * * , npy_intp * , npy_intp * , void * );
74
74
NPY_NO_EXPORT void PyUFunc_e_e_As_f_f \
75
- (char * * , npy_intp const * , npy_intp const * , void * );
75
+ (char * * , npy_intp * , npy_intp * , void * );
76
76
NPY_NO_EXPORT void PyUFunc_e_e_As_d_d \
77
- (char * * , npy_intp const * , npy_intp const * , void * );
77
+ (char * * , npy_intp * , npy_intp * , void * );
78
78
NPY_NO_EXPORT void PyUFunc_ee_e \
79
- (char * * , npy_intp const * , npy_intp const * , void * );
79
+ (char * * , npy_intp * , npy_intp * , void * );
80
80
NPY_NO_EXPORT void PyUFunc_ee_e_As_ff_f \
81
- (char * * , npy_intp const * , npy_intp const * , void * );
81
+ (char * * , npy_intp * , npy_intp * , void * );
82
82
NPY_NO_EXPORT void PyUFunc_ee_e_As_dd_d \
83
- (char * * , npy_intp const * , npy_intp const * , void * );
83
+ (char * * , npy_intp * , npy_intp * , void * );
84
84
NPY_NO_EXPORT int PyUFunc_DefaultTypeResolver \
85
85
(PyUFuncObject * , NPY_CASTING , PyArrayObject * * , PyObject * , PyArray_Descr * * );
86
86
NPY_NO_EXPORT int PyUFunc_ValidateCasting \
@@ -117,67 +117,67 @@ static void **PyUFunc_API=NULL;
117
117
(*(int (*)(PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **)) \
118
118
PyUFunc_API[3])
119
119
#define PyUFunc_f_f_As_d_d \
120
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
120
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
121
121
PyUFunc_API[4])
122
122
#define PyUFunc_d_d \
123
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
123
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
124
124
PyUFunc_API[5])
125
125
#define PyUFunc_f_f \
126
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
126
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
127
127
PyUFunc_API[6])
128
128
#define PyUFunc_g_g \
129
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
129
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
130
130
PyUFunc_API[7])
131
131
#define PyUFunc_F_F_As_D_D \
132
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
132
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
133
133
PyUFunc_API[8])
134
134
#define PyUFunc_F_F \
135
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
135
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
136
136
PyUFunc_API[9])
137
137
#define PyUFunc_D_D \
138
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
138
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
139
139
PyUFunc_API[10])
140
140
#define PyUFunc_G_G \
141
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
141
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
142
142
PyUFunc_API[11])
143
143
#define PyUFunc_O_O \
144
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
144
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
145
145
PyUFunc_API[12])
146
146
#define PyUFunc_ff_f_As_dd_d \
147
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
147
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
148
148
PyUFunc_API[13])
149
149
#define PyUFunc_ff_f \
150
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
150
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
151
151
PyUFunc_API[14])
152
152
#define PyUFunc_dd_d \
153
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
153
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
154
154
PyUFunc_API[15])
155
155
#define PyUFunc_gg_g \
156
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
156
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
157
157
PyUFunc_API[16])
158
158
#define PyUFunc_FF_F_As_DD_D \
159
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
159
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
160
160
PyUFunc_API[17])
161
161
#define PyUFunc_DD_D \
162
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
162
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
163
163
PyUFunc_API[18])
164
164
#define PyUFunc_FF_F \
165
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
165
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
166
166
PyUFunc_API[19])
167
167
#define PyUFunc_GG_G \
168
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
168
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
169
169
PyUFunc_API[20])
170
170
#define PyUFunc_OO_O \
171
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
171
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
172
172
PyUFunc_API[21])
173
173
#define PyUFunc_O_O_method \
174
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
174
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
175
175
PyUFunc_API[22])
176
176
#define PyUFunc_OO_O_method \
177
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
177
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
178
178
PyUFunc_API[23])
179
179
#define PyUFunc_On_Om \
180
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
180
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
181
181
PyUFunc_API[24])
182
182
#define PyUFunc_GetPyValues \
183
183
(*(int (*)(char *, int *, int *, PyObject **)) \
@@ -204,22 +204,22 @@ static void **PyUFunc_API=NULL;
204
204
(*(int (*)(void **, size_t)) \
205
205
PyUFunc_API[32])
206
206
#define PyUFunc_e_e \
207
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
207
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
208
208
PyUFunc_API[33])
209
209
#define PyUFunc_e_e_As_f_f \
210
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
210
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
211
211
PyUFunc_API[34])
212
212
#define PyUFunc_e_e_As_d_d \
213
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
213
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
214
214
PyUFunc_API[35])
215
215
#define PyUFunc_ee_e \
216
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
216
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
217
217
PyUFunc_API[36])
218
218
#define PyUFunc_ee_e_As_ff_f \
219
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
219
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
220
220
PyUFunc_API[37])
221
221
#define PyUFunc_ee_e_As_dd_d \
222
- (*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
222
+ (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
223
223
PyUFunc_API[38])
224
224
#define PyUFunc_DefaultTypeResolver \
225
225
(*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **)) \
@@ -252,12 +252,21 @@ _import_umath(void)
252
252
return -1 ;
253
253
}
254
254
255
+ #if PY_VERSION_HEX >= 0x03000000
255
256
if (!PyCapsule_CheckExact (c_api )) {
256
257
PyErr_SetString (PyExc_RuntimeError , "_UFUNC_API is not PyCapsule object" );
257
258
Py_DECREF (c_api );
258
259
return -1 ;
259
260
}
260
261
PyUFunc_API = (void * * )PyCapsule_GetPointer (c_api , NULL );
262
+ #else
263
+ if (!PyCObject_Check (c_api )) {
264
+ PyErr_SetString (PyExc_RuntimeError , "_UFUNC_API is not PyCObject object" );
265
+ Py_DECREF (c_api );
266
+ return -1 ;
267
+ }
268
+ PyUFunc_API = (void * * )PyCObject_AsVoidPtr (c_api );
269
+ #endif
261
270
Py_DECREF (c_api );
262
271
if (PyUFunc_API == NULL ) {
263
272
PyErr_SetString (PyExc_RuntimeError , "_UFUNC_API is NULL pointer" );
@@ -266,14 +275,20 @@ _import_umath(void)
266
275
return 0 ;
267
276
}
268
277
278
+ #if PY_VERSION_HEX >= 0x03000000
279
+ #define NUMPY_IMPORT_UMATH_RETVAL NULL
280
+ #else
281
+ #define NUMPY_IMPORT_UMATH_RETVAL
282
+ #endif
283
+
269
284
#define import_umath () \
270
285
do {\
271
286
UFUNC_NOFPE\
272
287
if (_import_umath() < 0) {\
273
288
PyErr_Print();\
274
289
PyErr_SetString(PyExc_ImportError,\
275
290
"numpy.core.umath failed to import");\
276
- return NULL ;\
291
+ return NUMPY_IMPORT_UMATH_RETVAL ;\
277
292
}\
278
293
} while(0)
279
294
0 commit comments