summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2023-01-02 14:22:21 +0200
committermattip <matti.picus@gmail.com>2023-01-02 14:22:21 +0200
commit333d01246db2e270288123095fc8be1ba5206ef4 (patch)
tree9ae2f25e0584567002c7e1cdc849b6e918f13a71 /numpy/core/src
parentc95932eecccad8d3c8e77ae1f7b8238be95d3e78 (diff)
downloadnumpy-333d01246db2e270288123095fc8be1ba5206ef4.tar.gz
Revert "MAINT: elide the generic_wrapped_legacy_loop wrapper out of the hot loop"
This reverts commit 154c293786a29cfbf976f08cab48698166d99399.
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/umath/legacy_array_method.c13
-rw-r--r--numpy/core/src/umath/ufunc_object.c19
2 files changed, 8 insertions, 24 deletions
diff --git a/numpy/core/src/umath/legacy_array_method.c b/numpy/core/src/umath/legacy_array_method.c
index a0b12f7f2..96cc7a2f1 100644
--- a/numpy/core/src/umath/legacy_array_method.c
+++ b/numpy/core/src/umath/legacy_array_method.c
@@ -95,19 +95,6 @@ int
is_generic_wrapped_legacy_loop(PyArrayMethod_StridedLoop *strided_loop) {
return strided_loop == generic_wrapped_legacy_loop;
}
-
-PyUFuncGenericFunction
-get_inner_loop(void * auxdata) {
- legacy_array_method_auxdata *ldata = (legacy_array_method_auxdata *)auxdata;
- return ldata->loop;
-}
-
-int
-get_pyerr_check(void * auxdata) {
- legacy_array_method_auxdata *ldata = (legacy_array_method_auxdata *)auxdata;
- return ldata->pyerr_check;
-}
-
/*
* Signal that the old type-resolution function must be used to resolve
* the descriptors (mainly/only used for datetimes due to the unit).
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index f928eb33b..969bfbca5 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -5944,15 +5944,15 @@ new_array_op(PyArrayObject *op_array, char *data)
}
int is_generic_wrapped_legacy_loop(PyArrayMethod_StridedLoop *strided_loop);
-PyUFuncGenericFunction get_inner_loop(void * auxdata);
-int get_pyerr_check(void * auxdata);
static int
ufunc_at__fast_iter(PyUFuncObject *ufunc, NPY_ARRAYMETHOD_FLAGS flags,
PyArrayMapIterObject *iter, PyArrayIterObject *iter2,
PyArrayObject *op1_array, PyArrayObject *op2_array,
- PyUFuncGenericFunction loop, int pyerr_check,
- npy_intp strides[3]
+ PyArrayMethod_StridedLoop *strided_loop,
+ PyArrayMethod_Context *context,
+ npy_intp strides[3],
+ NpyAuxData *auxdata
)
{
int buffersize;
@@ -5998,9 +5998,8 @@ ufunc_at__fast_iter(PyUFuncObject *ufunc, NPY_ARRAYMETHOD_FLAGS flags,
dataptr[2] = NULL;
}
- loop(dataptr, &count, strides, NULL);
- if (pyerr_check && PyErr_Occurred()) {
- res = -1;
+ res = strided_loop(context, dataptr, &count, strides, auxdata);
+ if (res != 0) {
break;
}
@@ -6440,10 +6439,8 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
fast_path = 0;
}
if (fast_path) {
- PyUFuncGenericFunction loop = get_inner_loop(auxdata);
-
- res = ufunc_at__fast_iter(ufunc, flags, iter, iter2, op1_array,
- op2_array, loop, get_pyerr_check(auxdata), strides);
+ res = ufunc_at__fast_iter(ufunc, flags, iter, iter2, op1_array, op2_array,
+ strided_loop, &context, strides, auxdata);
} else {
res = ufunc_at__slow_iter(ufunc, flags, iter, iter2, op1_array, op2_array,
operation_descrs, strided_loop, &context, strides, auxdata);