summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-06-17 09:56:16 -0600
committerGitHub <noreply@github.com>2021-06-17 09:56:16 -0600
commit7fe64b4a15daa340ed086b6bab85c1a274e5ea6f (patch)
tree35b5a77270db5d02703645408ed4209eb60aa1bf /numpy/core
parent0fe94ce8a6c4fbe94305e4a4be45fe06e774be29 (diff)
parent28dceccde97af2554dd151d8ea879997f171c08f (diff)
downloadnumpy-7fe64b4a15daa340ed086b6bab85c1a274e5ea6f.tar.gz
Merge pull request #19262 from seberg/maint-ufunc-object-tiny
MAINT: Some tiny fixes and style changes in `ufunc_object.c`
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/umath/ufunc_object.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 0644a28c0..1f6315a1f 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -3186,7 +3186,7 @@ PyUFunc_Accumulate(PyUFuncObject *ufunc, PyArrayObject *arr, PyArrayObject *out,
int idim, ndim, otype_final;
int needs_api, need_outer_iterator;
- NpyIter *iter = NULL, *iter_inner = NULL;
+ NpyIter *iter = NULL;
/* The selected inner loop */
PyUFuncGenericFunction innerloop = NULL;
@@ -3512,9 +3512,6 @@ finish:
if (!NpyIter_Deallocate(iter)) {
res = -1;
}
- if (!NpyIter_Deallocate(iter_inner)) {
- res = -1;
- }
if (res < 0) {
Py_DECREF(out);
return NULL;
@@ -3527,7 +3524,6 @@ fail:
Py_XDECREF(op_dtypes[0]);
NpyIter_Deallocate(iter);
- NpyIter_Deallocate(iter_inner);
return NULL;
}
@@ -4263,8 +4259,8 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc,
*/
int typenum = PyArray_TYPE(mp);
if ((PyTypeNum_ISBOOL(typenum) || PyTypeNum_ISINTEGER(typenum))
- && ((strcmp(ufunc->name,"add") == 0)
- || (strcmp(ufunc->name,"multiply") == 0))) {
+ && ((strcmp(ufunc->name, "add") == 0)
+ || (strcmp(ufunc->name, "multiply") == 0))) {
if (PyTypeNum_ISBOOL(typenum)) {
typenum = NPY_LONG;
}
@@ -4310,9 +4306,9 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc,
"reduceat does not allow multiple axes");
goto fail;
}
- ret = (PyArrayObject *)PyUFunc_Reduceat(ufunc, mp, indices, out,
- axes[0], otype->type_num);
- Py_DECREF(indices);
+ ret = (PyArrayObject *)PyUFunc_Reduceat(ufunc,
+ mp, indices, out, axes[0], otype->type_num);
+ Py_SETREF(indices, NULL);
break;
}
Py_DECREF(mp);
@@ -4354,6 +4350,7 @@ fail:
Py_XDECREF(otype);
Py_XDECREF(mp);
Py_XDECREF(wheremask);
+ Py_XDECREF(indices);
Py_XDECREF(full_args.in);
Py_XDECREF(full_args.out);
return NULL;