summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-12-02 20:22:00 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2020-12-02 20:25:16 -0600
commitd54e2dcc17e0f0a8702d4b0eb4ac30a5c927a056 (patch)
tree6e0bfbef7d17f3907c03a1b7e54e54431c12bfd1 /numpy/core
parente481e39350847af034bbab8e1237ef0085714886 (diff)
downloadnumpy-d54e2dcc17e0f0a8702d4b0eb4ac30a5c927a056.tar.gz
DEP: Finalize unravel_index `dims` alias for `shape` keyword
The argument was renamed to `shape` and deprecated since NumPy 1.16, so the deprecation can now be finalized.
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/multiarray.py5
-rw-r--r--numpy/core/src/multiarray/compiled_base.c35
2 files changed, 1 insertions, 39 deletions
diff --git a/numpy/core/multiarray.py b/numpy/core/multiarray.py
index f311fad8d..f736973de 100644
--- a/numpy/core/multiarray.py
+++ b/numpy/core/multiarray.py
@@ -999,7 +999,7 @@ def ravel_multi_index(multi_index, dims, mode=None, order=None):
@array_function_from_c_func_and_dispatcher(_multiarray_umath.unravel_index)
-def unravel_index(indices, shape=None, order=None, dims=None):
+def unravel_index(indices, shape=None, order=None):
"""
unravel_index(indices, shape, order='C')
@@ -1045,9 +1045,6 @@ def unravel_index(indices, shape=None, order=None, dims=None):
(3, 1, 4, 1)
"""
- if dims is not None:
- warnings.warn("'shape' argument should be used instead of 'dims'",
- DeprecationWarning, stacklevel=3)
return (indices,)
diff --git a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c
index 8ab592015..da857071b 100644
--- a/numpy/core/src/multiarray/compiled_base.c
+++ b/numpy/core/src/multiarray/compiled_base.c
@@ -1229,41 +1229,6 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)
char *kwlist[] = {"indices", "shape", "order", NULL};
- /*
- * TODO: remove this in favor of warning raised in the dispatcher when
- * __array_function__ is enabled by default.
- */
-
- /*
- * Continue to support the older "dims" argument in place
- * of the "shape" argument. Issue an appropriate warning
- * if "dims" is detected in keywords, then replace it with
- * the new "shape" argument and continue processing as usual.
- */
- if (kwds) {
- PyObject *dims_item, *shape_item;
- dims_item = _PyDict_GetItemStringWithError(kwds, "dims");
- if (dims_item == NULL && PyErr_Occurred()){
- return NULL;
- }
- shape_item = _PyDict_GetItemStringWithError(kwds, "shape");
- if (shape_item == NULL && PyErr_Occurred()){
- return NULL;
- }
- if (dims_item != NULL && shape_item == NULL) {
- if (DEPRECATE("'shape' argument should be"
- " used instead of 'dims'") < 0) {
- return NULL;
- }
- if (PyDict_SetItemString(kwds, "shape", dims_item) < 0) {
- return NULL;
- }
- if (PyDict_DelItemString(kwds, "dims") < 0) {
- return NULL;
- }
- }
- }
-
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&|O&:unravel_index",
kwlist,
&indices0,