1
- diff -u -r a/numpy/core/src/_simd/_simd_convert.inc b/numpy/core/src/_simd/_simd_convert.inc
2
- --- a/numpy/core/src/_simd/_simd_convert.inc 2022-10-10 13:53:09.000000000 +0200
3
- +++ b/numpy/core/src/_simd/_simd_convert.inc 2022-10-10 13:53:08.000000000 +0200
4
- @@ -101,9 +101,8 @@
1
+ diff --git a/numpy/core/src/_simd/_simd_convert.inc b/numpy/core/src/_simd/_simd_convert.inc
2
+ index 46e0444..261cf5b 100644
3
+ --- a/numpy/core/src/_simd/_simd_convert.inc
4
+ +++ b/numpy/core/src/_simd/_simd_convert.inc
5
+ @@ -101,9 +101,8 @@ simd_sequence_from_iterable(PyObject *obj, simd_data_type dtype, Py_ssize_t min_
5
6
if (dst == NULL) {
6
7
return NULL;
7
8
}
@@ -12,10 +13,11 @@ diff -u -r a/numpy/core/src/_simd/_simd_convert.inc b/numpy/core/src/_simd/_simd
12
13
npyv_lanetype_u8 *sdst = dst + i * info->lane_size;
13
14
memcpy(sdst, &data.u64, info->lane_size);
14
15
}
15
- diff -u -r a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufunc_override.c
16
- --- a/numpy/core/src/common/ufunc_override.c 2022-10-10 13:53:09.000000000 +0200
17
- +++ b/numpy/core/src/common/ufunc_override.c 2022-10-10 13:53:08.000000000 +0200
18
- @@ -79,13 +79,12 @@
16
+ diff --git a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufunc_override.c
17
+ index 4fb4d4b..06552f0 100644
18
+ --- a/numpy/core/src/common/ufunc_override.c
19
+ +++ b/numpy/core/src/common/ufunc_override.c
20
+ @@ -79,13 +79,12 @@ PyUFunc_HasOverride(PyObject * obj)
19
21
/*
20
22
* Get possible out argument from kwds, and returns the number of outputs
21
23
* contained within it: if a tuple, the number of elements in it, 1 otherwise.
@@ -31,7 +33,7 @@ diff -u -r a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufun
31
33
{
32
34
if (kwds == NULL) {
33
35
Py_INCREF(Py_None);
34
- @@ -121,13 +120,11 @@
36
+ @@ -121,13 +120,11 @@ PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj, PyObject *
35
37
*out_kwd_obj = NULL;
36
38
return -1;
37
39
}
@@ -46,10 +48,11 @@ diff -u -r a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufun
46
48
return 1;
47
49
}
48
50
}
49
- diff -u -r a/numpy/core/src/common/ufunc_override.h b/numpy/core/src/common/ufunc_override.h
50
- --- a/numpy/core/src/common/ufunc_override.h 2022-10-10 13:53:09.000000000 +0200
51
- +++ b/numpy/core/src/common/ufunc_override.h 2022-10-10 13:53:08.000000000 +0200
52
- @@ -27,12 +27,11 @@
51
+ diff --git a/numpy/core/src/common/ufunc_override.h b/numpy/core/src/common/ufunc_override.h
52
+ index 5da95fb..3879016 100644
53
+ --- a/numpy/core/src/common/ufunc_override.h
54
+ +++ b/numpy/core/src/common/ufunc_override.h
55
+ @@ -27,12 +27,11 @@ PyUFunc_HasOverride(PyObject *obj);
53
56
/*
54
57
* Get possible out argument from kwds, and returns the number of outputs
55
58
* contained within it: if a tuple, the number of elements in it, 1 otherwise.
@@ -64,18 +67,19 @@ diff -u -r a/numpy/core/src/common/ufunc_override.h b/numpy/core/src/common/ufun
64
67
+ PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj);
65
68
66
69
#endif /* NUMPY_CORE_SRC_COMMON_UFUNC_OVERRIDE_H_ */
67
- diff -u -r a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c
68
- --- a/numpy/core/src/multiarray/array_coercion.c 2022-10-10 13:53:09.000000000 +0200
69
- +++ b/numpy/core/src/multiarray/array_coercion.c 2022-10-10 13:53:08.000000000 +0200
70
- @@ -1106,7 +1106,6 @@
70
+ diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c
71
+ index 562e4f0..1ed009b 100644
72
+ --- a/numpy/core/src/multiarray/array_coercion.c
73
+ +++ b/numpy/core/src/multiarray/array_coercion.c
74
+ @@ -1106,7 +1106,6 @@ PyArray_DiscoverDTypeAndShape_Recursive(
71
75
}
72
76
73
77
npy_intp size = PySequence_Fast_GET_SIZE(seq);
74
78
- PyObject **objects = PySequence_Fast_ITEMS(seq);
75
79
76
80
if (update_shape(curr_dims, &max_dims,
77
81
out_shape, 1, &size, NPY_TRUE, flags) < 0) {
78
- @@ -1128,7 +1127,7 @@
82
+ @@ -1128,7 +1127,7 @@ PyArray_DiscoverDTypeAndShape_Recursive(
79
83
/* Recursive call for each sequence item */
80
84
for (Py_ssize_t i = 0; i < size; i++) {
81
85
max_dims = PyArray_DiscoverDTypeAndShape_Recursive(
@@ -84,10 +88,11 @@ diff -u -r a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiar
84
88
out_descr, out_shape, coercion_cache_tail_ptr, fixed_DType,
85
89
flags, never_copy);
86
90
87
- diff -u -r a/numpy/core/src/multiarray/arrayfunction_override.c b/numpy/core/src/multiarray/arrayfunction_override.c
88
- --- a/numpy/core/src/multiarray/arrayfunction_override.c 2022-10-10 13:53:09.000000000 +0200
89
- +++ b/numpy/core/src/multiarray/arrayfunction_override.c 2022-10-10 13:53:08.000000000 +0200
90
- @@ -72,12 +72,11 @@
91
+ diff --git a/numpy/core/src/multiarray/arrayfunction_override.c b/numpy/core/src/multiarray/arrayfunction_override.c
92
+ index af53d78..1fcd6d3 100644
93
+ --- a/numpy/core/src/multiarray/arrayfunction_override.c
94
+ +++ b/numpy/core/src/multiarray/arrayfunction_override.c
95
+ @@ -72,12 +72,11 @@ get_implementing_args_and_methods(PyObject *relevant_args,
91
96
{
92
97
int num_implementing_args = 0;
93
98
@@ -101,7 +106,7 @@ diff -u -r a/numpy/core/src/multiarray/arrayfunction_override.c b/numpy/core/src
101
106
102
107
/* Have we seen this type before? */
103
108
for (int j = 0; j < num_implementing_args; j++) {
104
- @@ -156,12 +155,11 @@
109
+ @@ -156,12 +155,11 @@ NPY_NO_EXPORT PyObject *
105
110
array_function_method_impl(PyObject *func, PyObject *types, PyObject *args,
106
111
PyObject *kwargs)
107
112
{
@@ -115,10 +120,11 @@ diff -u -r a/numpy/core/src/multiarray/arrayfunction_override.c b/numpy/core/src
115
120
if (is_subclass == -1) {
116
121
return NULL;
117
122
}
118
- diff -u -r a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c
119
- --- a/numpy/core/src/multiarray/compiled_base.c 2022-10-10 13:53:09.000000000 +0200
120
- +++ b/numpy/core/src/multiarray/compiled_base.c 2022-10-10 13:53:08.000000000 +0200
121
- @@ -1414,78 +1414,78 @@
123
+ diff --git a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c
124
+ index 2b82aca..7260b1b 100644
125
+ --- a/numpy/core/src/multiarray/compiled_base.c
126
+ +++ b/numpy/core/src/multiarray/compiled_base.c
127
+ @@ -1414,78 +1414,78 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
122
128
return NULL;
123
129
}
124
130
@@ -134,7 +140,7 @@ diff -u -r a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarr
134
140
-
135
141
- if (Py_TYPE(obj) == &PyCFunction_Type) {
136
142
- PyCFunctionObject *new = (PyCFunctionObject *)obj;
137
- - _ADDDOC(new->m_ml->ml_doc , new->m_ml->ml_name);
143
+ - _ADDDOC(PyObject_GetDoc((PyObject*)( new)) , new->m_ml->ml_name);
138
144
- }
139
145
- else if (PyObject_TypeCheck(obj, &PyType_Type)) {
140
146
- /*
@@ -194,85 +200,86 @@ diff -u -r a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarr
194
200
- }
195
201
-
196
202
- #undef _ADDDOC
197
- + //#define _ADDDOC(doc, name) \
198
- + // if (!(doc)) { \
199
- + // doc = docstr; \
200
- + // Py_INCREF(str); /* hold on to string (leaks reference) */ \
201
- + // } \
202
- + // else if (strcmp(doc, docstr) != 0) { \
203
- + // PyErr_Format(PyExc_RuntimeError, "%s method %s", name, msg); \
204
- + // return NULL; \
205
- + // }
206
- + //
207
- + // if (Py_TYPE(obj) == &PyCFunction_Type) {
208
- + // PyCFunctionObject *new = (PyCFunctionObject *)obj;
209
- + // _ADDDOC(new->m_ml->ml_doc , new->m_ml->ml_name);
210
- + // }
211
- + // else if (PyObject_TypeCheck(obj, &PyType_Type)) {
212
- + // /*
213
- + // * We add it to both `tp_doc` and `__doc__` here. Note that in theory
214
- + // * `tp_doc` extracts the signature line, but we currently do not use
215
- + // * it. It may make sense to only add it as `__doc__` and
216
- + // * `__text_signature__` to the dict in the future.
217
- + // * The dictionary path is only necessary for heaptypes (currently not
218
- + // * used) and metaclasses.
219
- + // * If `__doc__` as stored in `tp_dict` is None, we assume this was
220
- + // * filled in by `PyType_Ready()` and should also be replaced.
221
- + // */
222
- + // PyTypeObject *new = (PyTypeObject *)obj;
223
- + // _ADDDOC(new->tp_doc, new->tp_name);
224
- + // if (new->tp_dict != NULL && PyDict_CheckExact(new->tp_dict) &&
225
- + // PyDict_GetItemString(new->tp_dict, "__doc__") == Py_None) {
226
- + // /* Warning: Modifying `tp_dict` is not generally safe! */
227
- + // if (PyDict_SetItemString(new->tp_dict, "__doc__", str) < 0) {
228
- + // return NULL;
229
- + // }
230
- + // }
231
- + // }
232
- + // else if (Py_TYPE(obj) == &PyMemberDescr_Type) {
233
- + // PyMemberDescrObject *new = (PyMemberDescrObject *)obj;
234
- + // _ADDDOC(new->d_member->doc, new->d_member->name);
235
- + // }
236
- + // else if (Py_TYPE(obj) == &PyGetSetDescr_Type) {
237
- + // PyGetSetDescrObject *new = (PyGetSetDescrObject *)obj;
238
- + // _ADDDOC(new->d_getset->doc, new->d_getset->name);
239
- + // }
240
- + // else if (Py_TYPE(obj) == &PyMethodDescr_Type) {
241
- + // PyMethodDescrObject *new = (PyMethodDescrObject *)obj;
242
- + // _ADDDOC(new->d_method->ml_doc, new->d_method->ml_name);
243
- + // }
244
- + // else {
245
- + // PyObject *doc_attr;
246
- + //
247
- + // doc_attr = PyObject_GetAttrString(obj, "__doc__");
248
- + // if (doc_attr != NULL && doc_attr != Py_None &&
249
- + // (PyUnicode_Compare(doc_attr, str) != 0)) {
250
- + // Py_DECREF(doc_attr);
251
- + // if (PyErr_Occurred()) {
252
- + // /* error during PyUnicode_Compare */
253
- + // return NULL;
254
- + // }
255
- + // PyErr_Format(PyExc_RuntimeError, "object %s", msg);
256
- + // return NULL;
257
- + // }
258
- + // Py_XDECREF(doc_attr);
259
- + //
260
- + // if (PyObject_SetAttrString(obj, "__doc__", str) < 0) {
261
- + // PyErr_SetString(PyExc_TypeError,
262
- + // "Cannot set a docstring for that object");
263
- + // return NULL;
264
- + // }
265
- + // Py_RETURN_NONE;
266
- + // }
267
- + //
268
- + //#undef _ADDDOC
203
+ + // #define _ADDDOC(doc, name) \
204
+ + // if (!(doc)) { \
205
+ + // doc = docstr; \
206
+ + // Py_INCREF(str); /* hold on to string (leaks reference) */ \
207
+ + // } \
208
+ + // else if (strcmp(doc, docstr) != 0) { \
209
+ + // PyErr_Format(PyExc_RuntimeError, "%s method %s", name, msg); \
210
+ + // return NULL; \
211
+ + // }
212
+ + //
213
+ + // if (Py_TYPE(obj) == &PyCFunction_Type) {
214
+ + // PyCFunctionObject *new = (PyCFunctionObject *)obj;
215
+ + // _ADDDOC(PyObject_GetDoc((PyObject*)( new)) , new->m_ml->ml_name);
216
+ + // }
217
+ + // else if (PyObject_TypeCheck(obj, &PyType_Type)) {
218
+ + // /*
219
+ + // * We add it to both `tp_doc` and `__doc__` here. Note that in theory
220
+ + // * `tp_doc` extracts the signature line, but we currently do not use
221
+ + // * it. It may make sense to only add it as `__doc__` and
222
+ + // * `__text_signature__` to the dict in the future.
223
+ + // * The dictionary path is only necessary for heaptypes (currently not
224
+ + // * used) and metaclasses.
225
+ + // * If `__doc__` as stored in `tp_dict` is None, we assume this was
226
+ + // * filled in by `PyType_Ready()` and should also be replaced.
227
+ + // */
228
+ + // PyTypeObject *new = (PyTypeObject *)obj;
229
+ + // _ADDDOC(new->tp_doc, new->tp_name);
230
+ + // if (new->tp_dict != NULL && PyDict_CheckExact(new->tp_dict) &&
231
+ + // PyDict_GetItemString(new->tp_dict, "__doc__") == Py_None) {
232
+ + // /* Warning: Modifying `tp_dict` is not generally safe! */
233
+ + // if (PyDict_SetItemString(new->tp_dict, "__doc__", str) < 0) {
234
+ + // return NULL;
235
+ + // }
236
+ + // }
237
+ + // }
238
+ + // else if (Py_TYPE(obj) == &PyMemberDescr_Type) {
239
+ + // PyMemberDescrObject *new = (PyMemberDescrObject *)obj;
240
+ + // _ADDDOC(new->d_member->doc, new->d_member->name);
241
+ + // }
242
+ + // else if (Py_TYPE(obj) == &PyGetSetDescr_Type) {
243
+ + // PyGetSetDescrObject *new = (PyGetSetDescrObject *)obj;
244
+ + // _ADDDOC(new->d_getset->doc, new->d_getset->name);
245
+ + // }
246
+ + // else if (Py_TYPE(obj) == &PyMethodDescr_Type) {
247
+ + // PyMethodDescrObject *new = (PyMethodDescrObject *)obj;
248
+ + // _ADDDOC(new->d_method->ml_doc, new->d_method->ml_name);
249
+ + // }
250
+ + // else {
251
+ + // PyObject *doc_attr;
252
+ + //
253
+ + // doc_attr = PyObject_GetAttrString(obj, "__doc__");
254
+ + // if (doc_attr != NULL && doc_attr != Py_None &&
255
+ + // (PyUnicode_Compare(doc_attr, str) != 0)) {
256
+ + // Py_DECREF(doc_attr);
257
+ + // if (PyErr_Occurred()) {
258
+ + // /* error during PyUnicode_Compare */
259
+ + // return NULL;
260
+ + // }
261
+ + // PyErr_Format(PyExc_RuntimeError, "object %s", msg);
262
+ + // return NULL;
263
+ + // }
264
+ + // Py_XDECREF(doc_attr);
265
+ + //
266
+ + // if (PyObject_SetAttrString(obj, "__doc__", str) < 0) {
267
+ + // PyErr_SetString(PyExc_TypeError,
268
+ + // "Cannot set a docstring for that object");
269
+ + // return NULL;
270
+ + // }
271
+ + // Py_RETURN_NONE;
272
+ + // }
273
+ + //
274
+ + // #undef _ADDDOC
269
275
270
276
Py_RETURN_NONE;
271
277
}
272
- diff -u -r a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
273
- --- a/numpy/core/src/multiarray/iterators.c 2022-10-10 13:53:09.000000000 +0200
274
- +++ b/numpy/core/src/multiarray/iterators.c 2022-10-10 13:53:08.000000000 +0200
275
- @@ -1400,7 +1400,11 @@
278
+ diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
279
+ index f959162..2ef579b 100644
280
+ --- a/numpy/core/src/multiarray/iterators.c
281
+ +++ b/numpy/core/src/multiarray/iterators.c
282
+ @@ -1400,7 +1400,11 @@ arraymultiter_new(PyTypeObject *NPY_UNUSED(subtype), PyObject *args,
276
283
Py_DECREF(fast_seq);
277
284
return multiiter_wrong_number_of_args();
278
285
}
@@ -285,18 +292,19 @@ diff -u -r a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/i
285
292
Py_DECREF(fast_seq);
286
293
return ret;
287
294
}
288
- diff -u -r a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
289
- --- a/numpy/core/src/multiarray/methods.c 2022-10-10 13:53:09.000000000 +0200
290
- +++ b/numpy/core/src/multiarray/methods.c 2022-10-10 13:53:08.000000000 +0200
291
- @@ -1095,7 +1095,6 @@
295
+ diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
296
+ index 161dca1..bedca0c 100644
297
+ --- a/numpy/core/src/multiarray/methods.c
298
+ +++ b/numpy/core/src/multiarray/methods.c
299
+ @@ -1095,7 +1095,6 @@ any_array_ufunc_overrides(PyObject *args, PyObject *kwds)
292
300
int nin, nout;
293
301
PyObject *out_kwd_obj;
294
302
PyObject *fast;
295
303
- PyObject **in_objs, **out_objs;
296
304
297
305
/* check inputs */
298
306
nin = PyTuple_Size(args);
299
- @@ -1106,21 +1105,20 @@
307
+ @@ -1106,21 +1105,20 @@ any_array_ufunc_overrides(PyObject *args, PyObject *kwds)
300
308
if (fast == NULL) {
301
309
return -1;
302
310
}
@@ -321,10 +329,11 @@ diff -u -r a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/met
321
329
Py_DECREF(out_kwd_obj);
322
330
return 1;
323
331
}
324
- diff -u -r a/numpy/core/src/umath/extobj.c b/numpy/core/src/umath/extobj.c
325
- --- a/numpy/core/src/umath/extobj.c 2022-10-10 13:53:09.000000000 +0200
326
- +++ b/numpy/core/src/umath/extobj.c 2022-10-10 13:53:08.000000000 +0200
327
- @@ -283,7 +283,7 @@
332
+ diff --git a/numpy/core/src/umath/extobj.c b/numpy/core/src/umath/extobj.c
333
+ index 6b9a27e..8de94fb 100644
334
+ --- a/numpy/core/src/umath/extobj.c
335
+ +++ b/numpy/core/src/umath/extobj.c
336
+ @@ -283,7 +283,7 @@ _check_ufunc_fperr(int errmask, PyObject *extobj, const char *ufunc_name) {
328
337
if (!errmask) {
329
338
return 0;
330
339
}
@@ -333,20 +342,20 @@ diff -u -r a/numpy/core/src/umath/extobj.c b/numpy/core/src/umath/extobj.c
333
342
if (!fperr) {
334
343
return 0;
335
344
}
336
- diff -u -r a/tools/cythonize.py b/tools/cythonize.py
337
- --- a/tools/cythonize.py 2022-10-10 13:53:09.000000000 +0200
338
- +++ b/tools/cythonize.py 2022-10-10 13:53:07.000000000 +0200
339
- @@ -48,9 +48,14 @@
345
+ diff --git a/tools/cythonize.py b/tools/cythonize.py
346
+ index 002b2fa..fd05e01 100755
347
+ --- a/tools/cythonize.py
348
+ +++ b/tools/cythonize.py
349
+ @@ -48,9 +48,14 @@ def process_pyx(fromfile, tofile):
340
350
if tofile.endswith('.cxx'):
341
351
flags.append('--cplus')
342
352
343
353
- subprocess.check_call(
344
354
- [sys.executable, '-m', 'cython'] + flags + ["-o", tofile, fromfile])
345
- -
346
355
+ print("processing: " + (" ".join(flags + ["-o", tofile, fromfile])))
347
356
+ from Cython.Compiler.CmdLine import parse_command_line
348
357
+ from Cython.Compiler.Main import compile
349
- +
358
+
350
359
+ options, sources = parse_command_line(flags + ["-o", tofile, fromfile])
351
360
+ result = compile(sources, options)
352
361
+ if result.num_errors > 0:
0 commit comments