summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/umath/ufunc_object.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index e4ce437fb..3e0fcc08d 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -3052,17 +3052,15 @@ fail:
return retval;
}
-/*UFUNC_API
- *
+/*
* This generic function is called with the ufunc object, the arguments to it,
* and an array of (pointers to) PyArrayObjects which are NULL.
*
* 'op' is an array of at least NPY_MAXARGS PyArrayObject *.
*/
-NPY_NO_EXPORT int
-PyUFunc_GenericFunction(PyUFuncObject *ufunc,
- PyObject *args, PyObject *kwds,
- PyArrayObject **op)
+static int
+PyUFunc_GenericFunction_int(PyUFuncObject *ufunc,
+ PyObject *args, PyObject *kwds, PyArrayObject **op)
{
int nin, nout;
int i, nop;
@@ -3268,6 +3266,27 @@ fail:
return retval;
}
+
+/*UFUNC_API*/
+NPY_NO_EXPORT int
+PyUFunc_GenericFunction(PyUFuncObject *ufunc,
+ PyObject *args, PyObject *kwds, PyArrayObject **op)
+{
+ /* NumPy 1.19, 2020-01-24 */
+ if (DEPRECATE(
+ "PyUFunc_GenericFunction() C-API function is deprecated "
+ "and expected to be removed rapidly. If you are using it (i.e. see "
+ "this warning/error), please notify the NumPy developers. "
+ "As of now it is expected that any use case is served better by "
+ "the direct use of `PyObject_Call(ufunc, args, kwargs)`. "
+ "PyUFunc_GenericFunction function has slightly different "
+ "untested behaviour.") < 0) {
+ return -1;
+ }
+ return PyUFunc_GenericFunction_int(ufunc, args, kwds, op);
+}
+
+
/*
* Given the output type, finds the specified binary op. The
* ufunc must have nin==2 and nout==1. The function may modify
@@ -4683,7 +4702,7 @@ ufunc_generic_call(PyUFuncObject *ufunc, PyObject *args, PyObject *kwds)
return override;
}
- errval = PyUFunc_GenericFunction(ufunc, args, kwds, mps);
+ errval = PyUFunc_GenericFunction_int(ufunc, args, kwds, mps);
if (errval < 0) {
return NULL;
}