summaryrefslogtreecommitdiffstats
path: root/Modules/_operator.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-13 10:41:05 (GMT)
committerGitHub <noreply@github.com>2022-05-13 10:41:05 (GMT)
commitf62ad4f2c4214fdc05cc45c27a5c068553c7942c (patch)
tree5c8cf46c3ae7c874ac601f3e18357a1862474fba /Modules/_operator.c
parent22a1db378c5c381272362c5b2f68ac78a368e136 (diff)
downloadcpython-f62ad4f2c4214fdc05cc45c27a5c068553c7942c.zip
cpython-f62ad4f2c4214fdc05cc45c27a5c068553c7942c.tar.gz
cpython-f62ad4f2c4214fdc05cc45c27a5c068553c7942c.tar.bz2
gh-89653: Use int type for Unicode kind (#92704)
Use the same type that PyUnicode_FromKindAndData() kind parameter type (public C API): int.
Diffstat (limited to 'Modules/_operator.c')
-rw-r--r--Modules/_operator.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 739ae5b..1af4a4f 100644
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -1230,9 +1230,6 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
/* prepare attr while checking args */
for (idx = 0; idx < nattrs; ++idx) {
PyObject *item = PyTuple_GET_ITEM(args, idx);
- Py_ssize_t item_len;
- const void *data;
- unsigned int kind;
int dot_count;
if (!PyUnicode_Check(item)) {
@@ -1245,9 +1242,9 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(attr);
return NULL;
}
- item_len = PyUnicode_GET_LENGTH(item);
- kind = PyUnicode_KIND(item);
- data = PyUnicode_DATA(item);
+ Py_ssize_t item_len = PyUnicode_GET_LENGTH(item);
+ int kind = PyUnicode_KIND(item);
+ const void *data = PyUnicode_DATA(item);
/* check whether the string is dotted */
dot_count = 0;