summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-11 19:55:01 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-11 19:55:01 (GMT)
commitbeac78bb242ba56088570d9df3a852f581adc0d5 (patch)
tree23482d5390130c302c2783344903218a1ab229aa /Python/getargs.c
parente459a0877e0ca76e3af1057722a0e366395c661f (diff)
downloadcpython-beac78bb242ba56088570d9df3a852f581adc0d5.zip
cpython-beac78bb242ba56088570d9df3a852f581adc0d5.tar.gz
cpython-beac78bb242ba56088570d9df3a852f581adc0d5.tar.bz2
Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE()
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 2c2db36..f2cc9f4 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -982,10 +982,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
STORE_SIZE(0);
}
else if (PyUnicode_Check(arg)) {
- *p = PyUnicode_AS_UNICODE(arg);
+ Py_ssize_t len;
+ *p = PyUnicode_AsUnicodeAndSize(arg, &len);
if (*p == NULL)
RETURN_ERR_OCCURRED;
- STORE_SIZE(PyUnicode_GET_SIZE(arg));
+ STORE_SIZE(len);
}
else
return converterr("str or None", arg, msgbuf, bufsize);
@@ -995,10 +996,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (c == 'Z' && arg == Py_None)
*p = NULL;
else if (PyUnicode_Check(arg)) {
- *p = PyUnicode_AS_UNICODE(arg);
+ Py_ssize_t len;
+ *p = PyUnicode_AsUnicodeAndSize(arg, &len);
if (*p == NULL)
RETURN_ERR_OCCURRED;
- if (Py_UNICODE_strlen(*p) != PyUnicode_GET_SIZE(arg))
+ if (Py_UNICODE_strlen(*p) != len)
return converterr(
"str without null character or None",
arg, msgbuf, bufsize);