summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-06-20 17:20:41 +0100
committerEric Wieser <wieser.eric@gmail.com>2020-06-20 17:20:41 +0100
commit4f5d48f9568febad2ec15e904dbaea0492b2fb0b (patch)
tree9caa6c721188491e8c905f25e1e735c27d4bcffe
parente73c8e5479297f235b37fba91d6d0e8464be66a6 (diff)
downloadnumpy-4f5d48f9568febad2ec15e904dbaea0492b2fb0b.tar.gz
MAINT: Replace `PyUString_GET_SIZE` with `PyUnicode_GetLength`.
The former is deprecated. While they have slightly different meanings, the difference is irrelevant for comparison against 0. Also replaces `PyUString_Check` with `PyUnicode_Check` for consistency.
-rw-r--r--numpy/core/src/multiarray/ctors.c2
-rw-r--r--numpy/core/src/multiarray/descriptor.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index 3c3bcb387..2c2c457ac 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -2362,7 +2362,7 @@ _is_default_descr(PyObject *descr, PyObject *typestr) {
return 0;
}
name = PyTuple_GET_ITEM(tuple, 0);
- if (!(PyUString_Check(name) && PyUString_GET_SIZE(name) == 0)) {
+ if (!(PyUnicode_Check(name) && PyUnicode_GetLength(name) == 0)) {
return 0;
}
typestr2 = PyTuple_GET_ITEM(tuple, 1);
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c
index 8d884bc00..5b4a94aa4 100644
--- a/numpy/core/src/multiarray/descriptor.c
+++ b/numpy/core/src/multiarray/descriptor.c
@@ -469,7 +469,7 @@ _convert_from_array_descr(PyObject *obj, int align)
/* Insert name into nameslist */
Py_INCREF(name);
- if (PyUString_GET_SIZE(name) == 0) {
+ if (PyUnicode_GetLength(name) == 0) {
Py_DECREF(name);
if (title == NULL) {
name = PyUString_FromFormat("f%d", i);
@@ -478,7 +478,7 @@ _convert_from_array_descr(PyObject *obj, int align)
}
}
/* On Py3, allow only non-empty Unicode strings as field names */
- else if (PyUString_Check(title) && PyUString_GET_SIZE(title) > 0) {
+ else if (PyUnicode_Check(title) && PyUnicode_GetLength(title) > 0) {
name = title;
Py_INCREF(name);
}