summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2017-06-01 11:00:49 -0400
committerGitHub <noreply@github.com>2017-06-01 11:00:49 -0400
commitf6822b41f84c9b5f68bd3ebbb2c32af184438f10 (patch)
treed28aaa408dd08a1f1e7668c8c475fe2b245aca33
parent2f5721be9aabbf6b3ba03bbbeff9650fd441a08a (diff)
parentf44ef180a77245bcaba1b17eeb213e9730bc0884 (diff)
downloadnumpy-f6822b41f84c9b5f68bd3ebbb2c32af184438f10.tar.gz
Merge pull request #8187 from eric-wieser/accumulate-no-keepdim
MAINT: Remove the unused keepdim argument from np.ufunc.accumulate
-rw-r--r--numpy/add_newdocs.py4
-rw-r--r--numpy/core/src/umath/ufunc_object.c17
-rw-r--r--numpy/core/tests/test_deprecations.py10
3 files changed, 4 insertions, 27 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index a956440cd..de80affd2 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -5719,7 +5719,7 @@ add_newdoc('numpy.core', 'ufunc', ('reduce',
add_newdoc('numpy.core', 'ufunc', ('accumulate',
"""
- accumulate(array, axis=0, dtype=None, out=None, keepdims=None)
+ accumulate(array, axis=0, dtype=None, out=None)
Accumulate the result of applying the operator to all elements.
@@ -5756,8 +5756,6 @@ add_newdoc('numpy.core', 'ufunc', ('accumulate',
.. versionchanged:: 1.13.0
Tuples are allowed for keyword argument.
- keepdims : bool
- Has no effect. Deprecated, and will be removed in future.
Returns
-------
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index ea99560ea..c5ba15fa3 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -3900,7 +3900,7 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc, PyObject *args,
static char *reduce_kwlist[] = {
"array", "axis", "dtype", "out", "keepdims", NULL};
static char *accumulate_kwlist[] = {
- "array", "axis", "dtype", "out", "keepdims", NULL};
+ "array", "axis", "dtype", "out", NULL};
static char *reduceat_kwlist[] = {
"array", "indices", "axis", "dtype", "out", NULL};
@@ -3962,26 +3962,15 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc, PyObject *args,
}
}
else if (operation == UFUNC_ACCUMULATE) {
- PyObject *bad_keepdimarg = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&O:accumulate",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&:accumulate",
accumulate_kwlist,
&op,
&axes_in,
PyArray_DescrConverter2, &otype,
- PyArray_OutputConverter, &out,
- &bad_keepdimarg)) {
+ PyArray_OutputConverter, &out)) {
Py_XDECREF(otype);
return NULL;
}
- /* Until removed outright by https://github.com/numpy/numpy/pull/8187 */
- if (bad_keepdimarg != NULL) {
- if (DEPRECATE_FUTUREWARNING(
- "keepdims argument has no effect on accumulate, and will be "
- "removed in future") < 0) {
- Py_XDECREF(otype);
- return NULL;
- }
- }
}
else {
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&i:reduce",
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index 0ce7465fb..500f78c5f 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -376,16 +376,6 @@ class TestNumericStyleTypecodes(_DeprecationTestCase):
args=(dt,))
-class TestAccumulateKeepDims(_DeprecationTestCase):
- """
- Deprecate the keepdims argument to np.ufunc.accumulate, which was never used or documented
- """
- def test_keepdims(self):
- with warnings.catch_warnings():
- warnings.filterwarnings('always', '', FutureWarning)
- assert_warns(FutureWarning, np.add.accumulate, [1], keepdims=True)
-
-
class TestTestDeprecated(object):
def test_assert_deprecated(self):
test_case_instance = _DeprecationTestCase()