summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-09-30 17:35:05 -0600
committerCharles Harris <charlesr.harris@gmail.com>2020-10-01 07:30:11 -0600
commite6030ff2101e12abd01bd93b11a949821e26c248 (patch)
treee247006fcdd2838e35816b2e5fe247d0503705a2
parent247245ebec0513ba1450900024db2691698f20f4 (diff)
downloadnumpy-e6030ff2101e12abd01bd93b11a949821e26c248.tar.gz
MAINT: Remove the build_shape_string function.
The build_shape_string function is effectively a duplicate of the convert_shape_to_string function in common.c. All uses have now been replaced, so remove it.
-rw-r--r--numpy/core/src/multiarray/shape.c45
-rw-r--r--numpy/core/src/multiarray/shape.h7
2 files changed, 0 insertions, 52 deletions
diff --git a/numpy/core/src/multiarray/shape.c b/numpy/core/src/multiarray/shape.c
index 9dda89913..02c349759 100644
--- a/numpy/core/src/multiarray/shape.c
+++ b/numpy/core/src/multiarray/shape.c
@@ -977,51 +977,6 @@ PyArray_Flatten(PyArrayObject *a, NPY_ORDER order)
return (PyObject *)ret;
}
-/* See shape.h for parameters documentation */
-NPY_NO_EXPORT PyObject *
-build_shape_string(npy_intp n, npy_intp const *vals)
-{
- npy_intp i;
-
- /*
- * Negative dimension indicates "newaxis", which can
- * be discarded for printing if it's a leading dimension.
- * Find the first non-"newaxis" dimension.
- */
- for (i = 0; i < n && vals[i] < 0; ++i);
-
- if (i == n) {
- return PyUnicode_FromFormat("()");
- }
-
- PyObject *ret = PyUnicode_FromFormat("%" NPY_INTP_FMT, vals[i++]);
- if (ret == NULL) {
- return NULL;
- }
- for (; i < n; ++i) {
- PyObject *tmp;
-
- if (vals[i] < 0) {
- tmp = PyUnicode_FromString(",newaxis");
- }
- else {
- tmp = PyUnicode_FromFormat(",%" NPY_INTP_FMT, vals[i]);
- }
- if (tmp == NULL) {
- Py_DECREF(ret);
- return NULL;
- }
-
- Py_SETREF(ret, PyUnicode_Concat(ret, tmp));
- Py_DECREF(tmp);
- if (ret == NULL) {
- return NULL;
- }
- }
-
- Py_SETREF(ret, PyUnicode_FromFormat("(%S)", ret));
- return ret;
-}
/*NUMPY_API
*
diff --git a/numpy/core/src/multiarray/shape.h b/numpy/core/src/multiarray/shape.h
index d25292556..875b5430f 100644
--- a/numpy/core/src/multiarray/shape.h
+++ b/numpy/core/src/multiarray/shape.h
@@ -2,13 +2,6 @@
#define _NPY_ARRAY_SHAPE_H_
/*
- * Builds a string representation of the shape given in 'vals'.
- * A negative value in 'vals' gets interpreted as newaxis.
- */
-NPY_NO_EXPORT PyObject *
-build_shape_string(npy_intp n, npy_intp const *vals);
-
-/*
* Creates a sorted stride perm matching the KEEPORDER behavior
* of the NpyIter object. Because this operates based on multiple
* input strides, the 'stride' member of the npy_stride_sort_item