summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-11 22:11:42 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-11 22:11:42 +0200
commitc4f281eba3f2b33bc0a7d7172c44f3d1237c09b3 (patch)
tree6fb8eb484f53393c9b3fa2f6aa8a00d9c62c2135 /Modules
parented2682be2f6de05ead5f777ed3aaee92180df4f9 (diff)
downloadcpython-git-c4f281eba3f2b33bc0a7d7172c44f3d1237c09b3.tar.gz
Fix misuse of PyUnicode_GET_SIZE, use PyUnicode_GET_LENGTH instead
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_cursesmodule.c2
-rw-r--r--Modules/_io/stringio.c2
-rw-r--r--Modules/_json.c2
-rw-r--r--Modules/syslogmodule.c8
4 files changed, 6 insertions, 8 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index ead38d371e..7c89acc810 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2719,7 +2719,7 @@ PyCurses_ConvertToWchar_t(PyObject *obj,
PyErr_Format(PyExc_TypeError,
"expect bytes or str of length 1, or int, "
"got a str of length %zi",
- PyUnicode_GET_SIZE(obj));
+ PyUnicode_GET_LENGTH(obj));
return 0;
}
*wch = buffer[0];
diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c
index a4536b1b07..83a2465d4d 100644
--- a/Modules/_io/stringio.c
+++ b/Modules/_io/stringio.c
@@ -343,7 +343,7 @@ stringio_iternext(stringio *self)
if (line == NULL)
return NULL;
- if (PyUnicode_GET_SIZE(line) == 0) {
+ if (PyUnicode_GET_LENGTH(line) == 0) {
/* Reached EOF */
Py_DECREF(line);
return NULL;
diff --git a/Modules/_json.c b/Modules/_json.c
index e49d1b2f41..5a79294ccd 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -837,7 +837,7 @@ _parse_constant(PyScannerObject *s, char *constant, Py_ssize_t idx, Py_ssize_t *
/* rval = parse_constant(constant) */
rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL);
- idx += PyUnicode_GET_SIZE(cstr);
+ idx += PyUnicode_GET_LENGTH(cstr);
Py_DECREF(cstr);
*next_idx_ptr = idx;
return rval;
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index f6dadf43fa..c7a2487d29 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -90,18 +90,16 @@ syslog_get_argv(void)
if (!PyUnicode_Check(scriptobj)) {
return(NULL);
}
- scriptlen = PyUnicode_GET_SIZE(scriptobj);
+ scriptlen = PyUnicode_GET_LENGTH(scriptobj);
if (scriptlen == 0) {
return(NULL);
}
- slash = PyUnicode_FindChar(scriptobj, SEP,
- 0, PyUnicode_GET_LENGTH(scriptobj), -1);
+ slash = PyUnicode_FindChar(scriptobj, SEP, 0, scriptlen, -1);
if (slash == -2)
return NULL;
if (slash != -1) {
- return PyUnicode_Substring(scriptobj, slash,
- PyUnicode_GET_LENGTH(scriptobj));
+ return PyUnicode_Substring(scriptobj, slash, scriptlen);
} else {
Py_INCREF(scriptobj);
return(scriptobj);