diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-11 20:11:42 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-10-11 20:11:42 (GMT) |
| commit | c4f281eba3f2b33bc0a7d7172c44f3d1237c09b3 (patch) | |
| tree | 6fb8eb484f53393c9b3fa2f6aa8a00d9c62c2135 /Objects/unicodeobject.c | |
| parent | ed2682be2f6de05ead5f777ed3aaee92180df4f9 (diff) | |
| download | cpython-c4f281eba3f2b33bc0a7d7172c44f3d1237c09b3.zip cpython-c4f281eba3f2b33bc0a7d7172c44f3d1237c09b3.tar.gz cpython-c4f281eba3f2b33bc0a7d7172c44f3d1237c09b3.tar.bz2 | |
Fix misuse of PyUnicode_GET_SIZE, use PyUnicode_GET_LENGTH instead
Diffstat (limited to 'Objects/unicodeobject.c')
| -rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index fc42a28..f734b49 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -12181,7 +12181,7 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) if (z != NULL) { z_kind = PyUnicode_KIND(z); z_data = PyUnicode_DATA(z); - for (i = 0; i < PyUnicode_GET_SIZE(z); i++) { + for (i = 0; i < PyUnicode_GET_LENGTH(z); i++) { key = PyLong_FromLong(PyUnicode_READ(z_kind, z_data, i)); if (!key) goto err; @@ -12206,7 +12206,7 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) if (PyUnicode_Check(key)) { /* convert string keys to integer keys */ PyObject *newkey; - if (PyUnicode_GET_SIZE(key) != 1) { + if (PyUnicode_GET_LENGTH(key) != 1) { PyErr_SetString(PyExc_ValueError, "string keys in translate " "table must be of length 1"); goto err; @@ -13694,7 +13694,7 @@ unicodeiter_len(unicodeiterobject *it) { Py_ssize_t len = 0; if (it->it_seq) - len = PyUnicode_GET_SIZE(it->it_seq) - it->it_index; + len = PyUnicode_GET_LENGTH(it->it_seq) - it->it_index; return PyLong_FromSsize_t(len); } |
