diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-20 10:16:47 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-20 10:16:47 +0200 |
commit | 5d858465b6ebdafa05f86309457848cc26913b6a (patch) | |
tree | b7b6fc3238b3c9a4358d2b1523e6fa38d4e1469a /Objects/fileobject.c | |
parent | abbf5f179143f0c4e96fe5e507ea5f69ea195c9e (diff) | |
download | cpython-5d858465b6ebdafa05f86309457848cc26913b6a.tar.gz |
Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index f4424184d2..32f8a8983e 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -367,7 +367,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args) { PyObject *unicode; PyObject *bytes = NULL; - char *str; + const char *str; Py_ssize_t n; int err; @@ -389,10 +389,8 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args) bytes = _PyUnicode_AsUTF8String(unicode, "backslashreplace"); if (bytes == NULL) return NULL; - if (PyBytes_AsStringAndSize(bytes, &str, &n) < 0) { - Py_DECREF(bytes); - return NULL; - } + str = PyBytes_AS_STRING(bytes); + n = PyBytes_GET_SIZE(bytes); } n = _Py_write(self->fd, str, n); |