Skip to content

Commit 835e626

Browse files
committed
Rebase numpy 1.22.4 patch
1 parent 2347a37 commit 835e626

File tree

1 file changed

+62
-53
lines changed

1 file changed

+62
-53
lines changed

graalpython/lib-graalpython/patches/numpy/numpy-1.22.4.patch

Lines changed: 62 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
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-05-17 19:56:58.000000000 +0200
3-
+++ b/numpy/core/src/_simd/_simd_convert.inc 2022-05-31 16:49:13.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_
56
if (dst == NULL) {
67
return NULL;
78
}
@@ -12,10 +13,11 @@ diff -u -r a/numpy/core/src/_simd/_simd_convert.inc b/numpy/core/src/_simd/_simd
1213
npyv_lanetype_u8 *sdst = dst + i * info->lane_size;
1314
memcpy(sdst, &data.u64, info->lane_size);
1415
}
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-05-20 07:46:10.000000000 +0200
17-
+++ b/numpy/core/src/common/ufunc_override.c 2022-06-02 13:29:06.000000000 +0200
18-
@@ -73,13 +73,12 @@
16+
diff --git a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufunc_override.c
17+
index d510f18..205c6e4 100644
18+
--- a/numpy/core/src/common/ufunc_override.c
19+
+++ b/numpy/core/src/common/ufunc_override.c
20+
@@ -73,13 +73,12 @@ PyUFunc_HasOverride(PyObject * obj)
1921
/*
2022
* Get possible out argument from kwds, and returns the number of outputs
2123
* 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
3133
{
3234
if (kwds == NULL) {
3335
Py_INCREF(Py_None);
34-
@@ -115,13 +114,11 @@
36+
@@ -115,13 +114,11 @@ PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj, PyObject *
3537
*out_kwd_obj = NULL;
3638
return -1;
3739
}
@@ -46,10 +48,11 @@ diff -u -r a/numpy/core/src/common/ufunc_override.c b/numpy/core/src/common/ufun
4648
return 1;
4749
}
4850
}
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-05-17 19:56:58.000000000 +0200
51-
+++ b/numpy/core/src/common/ufunc_override.h 2022-05-31 16:49:13.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);
5356
/*
5457
* Get possible out argument from kwds, and returns the number of outputs
5558
* contained within it: if a tuple, the number of elements in it, 1 otherwise.
@@ -62,66 +65,69 @@ diff -u -r a/numpy/core/src/common/ufunc_override.h b/numpy/core/src/common/ufun
6265
NPY_NO_EXPORT int
6366
-PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj, PyObject ***out_objs);
6467
+PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj);
65-
68+
6669
#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-05-20 07:46:10.000000000 +0200
69-
+++ b/numpy/core/src/multiarray/array_coercion.c 2022-06-02 13:29:06.000000000 +0200
70-
@@ -1096,7 +1096,6 @@
70+
diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c
71+
index 2598e4b..661a358 100644
72+
--- a/numpy/core/src/multiarray/array_coercion.c
73+
+++ b/numpy/core/src/multiarray/array_coercion.c
74+
@@ -1096,7 +1096,6 @@ PyArray_DiscoverDTypeAndShape_Recursive(
7175
}
72-
76+
7377
npy_intp size = PySequence_Fast_GET_SIZE(seq);
7478
- PyObject **objects = PySequence_Fast_ITEMS(seq);
75-
79+
7680
if (update_shape(curr_dims, &max_dims,
7781
out_shape, 1, &size, NPY_TRUE, flags) < 0) {
78-
@@ -1118,7 +1117,7 @@
82+
@@ -1118,7 +1117,7 @@ PyArray_DiscoverDTypeAndShape_Recursive(
7983
/* Recursive call for each sequence item */
8084
for (Py_ssize_t i = 0; i < size; i++) {
8185
max_dims = PyArray_DiscoverDTypeAndShape_Recursive(
8286
- objects[i], curr_dims + 1, max_dims,
8387
+ PySequence_Fast_GET_ITEM(seq, i), curr_dims + 1, max_dims,
8488
out_descr, out_shape, coercion_cache_tail_ptr, fixed_DType,
8589
flags, never_copy);
86-
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-05-20 07:46:10.000000000 +0200
89-
+++ b/numpy/core/src/multiarray/arrayfunction_override.c 2022-06-02 13:29:06.000000000 +0200
90-
@@ -72,12 +72,11 @@
90+
91+
diff --git a/numpy/core/src/multiarray/arrayfunction_override.c b/numpy/core/src/multiarray/arrayfunction_override.c
92+
index 463a2d4..e235117 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,
9196
{
9297
int num_implementing_args = 0;
93-
98+
9499
- PyObject **items = PySequence_Fast_ITEMS(relevant_args);
95100
Py_ssize_t length = PySequence_Fast_GET_SIZE(relevant_args);
96-
101+
97102
for (Py_ssize_t i = 0; i < length; i++) {
98103
int new_class = 1;
99104
- PyObject *argument = items[i];
100105
+ PyObject *argument = PySequence_Fast_GET_ITEM(relevant_args, i);
101-
106+
102107
/* Have we seen this type before? */
103108
for (int j = 0; j < num_implementing_args; j++) {
104-
@@ -156,12 +155,11 @@
109+
@@ -156,12 +155,11 @@ NPY_NO_EXPORT PyObject *
105110
array_function_method_impl(PyObject *func, PyObject *types, PyObject *args,
106111
PyObject *kwargs)
107112
{
108113
- PyObject **items = PySequence_Fast_ITEMS(types);
109114
Py_ssize_t length = PySequence_Fast_GET_SIZE(types);
110-
115+
111116
for (Py_ssize_t j = 0; j < length; j++) {
112117
int is_subclass = PyObject_IsSubclass(
113118
- items[j], (PyObject *)&PyArray_Type);
114119
+ PySequence_Fast_GET_ITEM(types, j), (PyObject *)&PyArray_Type);
115120
if (is_subclass == -1) {
116121
return NULL;
117122
}
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-05-17 19:56:58.000000000 +0200
120-
+++ b/numpy/core/src/multiarray/compiled_base.c 2022-06-02 13:29:06.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..06edae2 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)
122128
return NULL;
123129
}
124-
130+
125131
-#define _ADDDOC(doc, name) \
126132
- if (!(doc)) { \
127133
- doc = docstr; \
@@ -134,7 +140,7 @@ diff -u -r a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarr
134140
-
135141
- if (Py_TYPE(obj) == &PyCFunction_Type) {
136142
- 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);
138144
- }
139145
- else if (PyObject_TypeCheck(obj, &PyType_Type)) {
140146
- /*
@@ -206,7 +212,7 @@ diff -u -r a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarr
206212
+//
207213
+// if (Py_TYPE(obj) == &PyCFunction_Type) {
208214
+// PyCFunctionObject *new = (PyCFunctionObject *)obj;
209-
+// _ADDDOC(new->m_ml->ml_doc, new->m_ml->ml_name);
215+
+// _ADDDOC(PyObject_GetDoc((PyObject*)(new)), new->m_ml->ml_name);
210216
+// }
211217
+// else if (PyObject_TypeCheck(obj, &PyType_Type)) {
212218
+// /*
@@ -266,13 +272,14 @@ diff -u -r a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarr
266272
+// }
267273
+//
268274
+//#undef _ADDDOC
269-
275+
270276
Py_RETURN_NONE;
271277
}
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-05-17 19:56:58.000000000 +0200
274-
+++ b/numpy/core/src/multiarray/iterators.c 2022-06-02 13:29:06.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,
276283
Py_DECREF(fast_seq);
277284
return multiiter_wrong_number_of_args();
278285
}
@@ -285,18 +292,19 @@ diff -u -r a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/i
285292
Py_DECREF(fast_seq);
286293
return ret;
287294
}
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-05-20 07:46:10.000000000 +0200
290-
+++ b/numpy/core/src/multiarray/methods.c 2022-06-03 11:29:22.000000000 +0200
291-
@@ -1064,7 +1064,6 @@
295+
diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
296+
index a5670db..80ec749 100644
297+
--- a/numpy/core/src/multiarray/methods.c
298+
+++ b/numpy/core/src/multiarray/methods.c
299+
@@ -1064,7 +1064,6 @@ any_array_ufunc_overrides(PyObject *args, PyObject *kwds)
292300
int nin, nout;
293301
PyObject *out_kwd_obj;
294302
PyObject *fast;
295303
- PyObject **in_objs, **out_objs;
296-
304+
297305
/* check inputs */
298306
nin = PyTuple_Size(args);
299-
@@ -1075,21 +1074,20 @@
307+
@@ -1075,21 +1074,20 @@ any_array_ufunc_overrides(PyObject *args, PyObject *kwds)
300308
if (fast == NULL) {
301309
return -1;
302310
}
@@ -321,10 +329,11 @@ diff -u -r a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/met
321329
Py_DECREF(out_kwd_obj);
322330
return 1;
323331
}
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-05-17 19:56:58.000000000 +0200
326-
+++ b/numpy/core/src/umath/extobj.c 2022-06-03 11:29:22.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) {
328337
if (!errmask) {
329338
return 0;
330339
}

0 commit comments

Comments
 (0)