summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Troisi <sethtroisi@google.com>2020-01-07 02:41:11 -0800
committerEric Wieser <wieser.eric@gmail.com>2020-01-07 10:41:11 +0000
commit6f26c12cf0377b926f43f827bd1291a941875751 (patch)
tree96769a1b77853c2866072764a2407850fe753896
parentee0bd96e489ba4419ef55d69bd8b2acb95ec7b3b (diff)
downloadnumpy-6f26c12cf0377b926f43f827bd1291a941875751.tar.gz
MAINT: Remove Python2 multiarray.c:array_unicode (#15268)
This implemented `ndarray.__unicode__` in Python 2, but that method isn't defined anyway in Python 3
-rw-r--r--numpy/core/src/multiarray/methods.c6
-rw-r--r--numpy/core/src/multiarray/strfuncs.c31
-rw-r--r--numpy/core/src/multiarray/strfuncs.h5
3 files changed, 0 insertions, 42 deletions
diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
index ae26bbd4a..3b6e37ac8 100644
--- a/numpy/core/src/multiarray/methods.c
+++ b/numpy/core/src/multiarray/methods.c
@@ -2705,12 +2705,6 @@ NPY_NO_EXPORT PyMethodDef array_methods[] = {
(PyCFunction)array_function,
METH_VARARGS | METH_KEYWORDS, NULL},
-#ifndef NPY_PY3K
- {"__unicode__",
- (PyCFunction)array_unicode,
- METH_NOARGS, NULL},
-#endif
-
/* for the sys module */
{"__sizeof__",
(PyCFunction) array_sizeof,
diff --git a/numpy/core/src/multiarray/strfuncs.c b/numpy/core/src/multiarray/strfuncs.c
index 33f3a6543..b570aec08 100644
--- a/numpy/core/src/multiarray/strfuncs.c
+++ b/numpy/core/src/multiarray/strfuncs.c
@@ -226,34 +226,3 @@ array_format(PyArrayObject *self, PyObject *args)
}
}
-#ifndef NPY_PY3K
-
-NPY_NO_EXPORT PyObject *
-array_unicode(PyArrayObject *self)
-{
- PyObject *uni;
-
- if (PyArray_NDIM(self) == 0) {
- PyObject *item = PyArray_ToScalar(PyArray_DATA(self), self);
- if (item == NULL){
- return NULL;
- }
-
- /* defer to invoking `unicode` on the scalar */
- uni = PyObject_CallFunctionObjArgs(
- (PyObject *)&PyUnicode_Type, item, NULL);
- Py_DECREF(item);
- }
- else {
- /* Do what unicode(self) would normally do */
- PyObject *str = PyObject_Str((PyObject *)self);
- if (str == NULL){
- return NULL;
- }
- uni = PyUnicode_FromObject(str);
- Py_DECREF(str);
- }
- return uni;
-}
-
-#endif
diff --git a/numpy/core/src/multiarray/strfuncs.h b/numpy/core/src/multiarray/strfuncs.h
index 7e869d926..5dd661a20 100644
--- a/numpy/core/src/multiarray/strfuncs.h
+++ b/numpy/core/src/multiarray/strfuncs.h
@@ -13,9 +13,4 @@ array_str(PyArrayObject *self);
NPY_NO_EXPORT PyObject *
array_format(PyArrayObject *self, PyObject *args);
-#ifndef NPY_PY3K
- NPY_NO_EXPORT PyObject *
- array_unicode(PyArrayObject *self);
-#endif
-
#endif