summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-10-01 17:32:51 -0600
committerCharles Harris <charlesr.harris@gmail.com>2015-10-01 17:32:51 -0600
commit21367df4ba6dbf4a01e5e4634b2e20ddb1f4c401 (patch)
tree6d0c710cf6f7f4726e5ad313dbbc8938c51cd620 /numpy
parent91e16f63474b43cd586e1a61e50285032f39a256 (diff)
parent899325ec043688c751001662f5e7226e7e92e04e (diff)
downloadnumpy-21367df4ba6dbf4a01e5e4634b2e20ddb1f4c401.tar.gz
Merge pull request #6336 from njsmith/clean-up-ufunc-dead-code
MAINT: cleanup dead code/arguments/fields from ufuncs
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/include/numpy/ufuncobject.h30
-rw-r--r--numpy/core/src/umath/ufunc_object.c30
-rw-r--r--numpy/core/src/umath/umathmodule.c1
3 files changed, 15 insertions, 46 deletions
diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h
index a24a0d837..1cca64b75 100644
--- a/numpy/core/include/numpy/ufuncobject.h
+++ b/numpy/core/include/numpy/ufuncobject.h
@@ -20,17 +20,6 @@ typedef void (*PyUFuncGenericFunction)
/*
* The most generic one-dimensional inner loop for
- * a standard element-wise ufunc. This typedef is also
- * more consistent with the other NumPy function pointer typedefs
- * than PyUFuncGenericFunction.
- */
-typedef void (PyUFunc_StridedInnerLoopFunc)(
- char **dataptrs, npy_intp *strides,
- npy_intp count,
- NpyAuxData *innerloopdata);
-
-/*
- * The most generic one-dimensional inner loop for
* a masked standard element-wise ufunc. "Masked" here means that it skips
* doing calculations on any items for which the maskptr array has a true
* value.
@@ -112,13 +101,6 @@ typedef int (PyUFunc_LegacyInnerLoopSelectionFunc)(
PyUFuncGenericFunction *out_innerloop,
void **out_innerloopdata,
int *out_needs_api);
-typedef int (PyUFunc_InnerLoopSelectionFunc)(
- struct _tagPyUFuncObject *ufunc,
- PyArray_Descr **dtypes,
- npy_intp *fixed_strides,
- PyUFunc_StridedInnerLoopFunc **out_innerloop,
- NpyAuxData **out_innerloopdata,
- int *out_needs_api);
typedef int (PyUFunc_MaskedInnerLoopSelectionFunc)(
struct _tagPyUFuncObject *ufunc,
PyArray_Descr **dtypes,
@@ -148,8 +130,8 @@ typedef struct _tagPyUFuncObject {
/* The number of elements in 'functions' and 'data' */
int ntypes;
- /* Does not appear to be used */
- int check_return;
+ /* Used to be unused field 'check_return' */
+ int reserved1;
/* The name of the ufunc */
const char *name;
@@ -204,11 +186,11 @@ typedef struct _tagPyUFuncObject {
*/
PyUFunc_LegacyInnerLoopSelectionFunc *legacy_inner_loop_selector;
/*
- * A function which returns an inner loop for the new mechanism
- * in NumPy 1.7 and later. If provided, this is used, otherwise
- * if NULL the legacy_inner_loop_selector is used instead.
+ * This was blocked off to be the "new" inner loop selector in 1.7,
+ * but this was never implemented. (This is also why the above
+ * selector is called the "legacy" selector.)
*/
- PyUFunc_InnerLoopSelectionFunc *inner_loop_selector;
+ void *reserved2;
/*
* A function which returns a masked inner loop for the ufunc.
*/
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 779773101..4bc9582b4 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -2623,22 +2623,9 @@ PyUFunc_GenericFunction(PyUFuncObject *ufunc,
else {
NPY_UF_DBG_PRINT("Executing legacy inner loop\n");
- if (ufunc->legacy_inner_loop_selector != NULL) {
- retval = execute_legacy_ufunc_loop(ufunc, trivial_loop_ok,
- op, dtypes, order,
- buffersize, arr_prep, arr_prep_args);
- }
- else {
- /*
- * TODO: When this is supported, it should be preferred over
- * the legacy_inner_loop_selector
- */
- PyErr_SetString(PyExc_RuntimeError,
- "usage of the new inner_loop_selector isn't "
- "implemented yet");
- retval = -1;
- goto fail;
- }
+ retval = execute_legacy_ufunc_loop(ufunc, trivial_loop_ok,
+ op, dtypes, order,
+ buffersize, arr_prep, arr_prep_args);
}
if (retval < 0) {
goto fail;
@@ -4480,10 +4467,10 @@ NPY_NO_EXPORT PyObject *
PyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data,
char *types, int ntypes,
int nin, int nout, int identity,
- const char *name, const char *doc, int check_return)
+ const char *name, const char *doc, int unused)
{
return PyUFunc_FromFuncAndDataAndSignature(func, data, types, ntypes,
- nin, nout, identity, name, doc, check_return, NULL);
+ nin, nout, identity, name, doc, 0, NULL);
}
/*UFUNC_API*/
@@ -4492,7 +4479,7 @@ PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void **data,
char *types, int ntypes,
int nin, int nout, int identity,
const char *name, const char *doc,
- int check_return, const char *signature)
+ int unused, const char *signature)
{
PyUFuncObject *ufunc;
@@ -4510,6 +4497,9 @@ PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void **data,
}
PyObject_Init((PyObject *)ufunc, &PyUFunc_Type);
+ ufunc->reserved1 = 0;
+ ufunc->reserved2 = NULL;
+
ufunc->nin = nin;
ufunc->nout = nout;
ufunc->nargs = nin+nout;
@@ -4519,7 +4509,6 @@ PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void **data,
ufunc->data = data;
ufunc->types = types;
ufunc->ntypes = ntypes;
- ufunc->check_return = check_return;
ufunc->ptr = NULL;
ufunc->obj = NULL;
ufunc->userloops=NULL;
@@ -4527,7 +4516,6 @@ PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void **data,
/* Type resolution and inner loop selection functions */
ufunc->type_resolver = &PyUFunc_DefaultTypeResolver;
ufunc->legacy_inner_loop_selector = &PyUFunc_DefaultLegacyInnerLoopSelector;
- ufunc->inner_loop_selector = NULL;
ufunc->masked_inner_loop_selector = &PyUFunc_DefaultMaskedInnerLoopSelector;
if (name == NULL) {
diff --git a/numpy/core/src/umath/umathmodule.c b/numpy/core/src/umath/umathmodule.c
index b1da2aeed..d19d5b9d2 100644
--- a/numpy/core/src/umath/umathmodule.c
+++ b/numpy/core/src/umath/umathmodule.c
@@ -123,7 +123,6 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUS
self->identity = PyUFunc_None;
self->functions = pyfunc_functions;
self->ntypes = 1;
- self->check_return = 0;
/* generalized ufunc */
self->core_enabled = 0;