summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-20 10:16:46 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-20 10:16:46 (GMT)
commit460bd0d284caa00eb8ccc9a28836ba30765a19cb (patch)
tree41169cfce0d00587f4222d3237a608b70577adfc /Python/getargs.c
parent6107f46bfbe4aa7b2ddb37ca5136d1d472c3f4aa (diff)
downloadcpython-460bd0d284caa00eb8ccc9a28836ba30765a19cb.zip
cpython-460bd0d284caa00eb8ccc9a28836ba30765a19cb.tar.gz
cpython-460bd0d284caa00eb8ccc9a28836ba30765a19cb.tar.bz2
Issue #19569: Compiler warnings are now emitted if use most of deprecated
functions.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index a6636f4..c552d0f 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1027,7 +1027,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
*p = PyUnicode_AsUnicodeAndSize(arg, &len);
if (*p == NULL)
RETURN_ERR_OCCURRED;
- if (Py_UNICODE_strlen(*p) != (size_t)len) {
+ if (wcslen(*p) != (size_t)len) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
RETURN_ERR_OCCURRED;
}
@@ -1074,9 +1074,14 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
(PyBytes_Check(arg) || PyByteArray_Check(arg))) {
s = arg;
Py_INCREF(s);
- if (PyObject_AsCharBuffer(s, &ptr, &size) < 0)
- return converterr("(AsCharBuffer failed)",
- arg, msgbuf, bufsize);
+ if (PyBytes_Check(arg)) {
+ size = PyBytes_GET_SIZE(s);
+ ptr = PyBytes_AS_STRING(s);
+ }
+ else {
+ size = PyByteArray_GET_SIZE(s);
+ ptr = PyByteArray_AS_STRING(s);
+ }
}
else if (PyUnicode_Check(arg)) {
/* Encode object; use default error handling */