diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-20 08:16:47 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-20 08:16:47 (GMT) |
commit | 85b0f5beb182cca8b1607accce2caab87ee29835 (patch) | |
tree | 0e55ae3180c2836152ceb4f9689fc7ed1ccb71c5 /Objects/fileobject.c | |
parent | a98c4a984b34f887076f4171b1e3303e164cbddf (diff) | |
download | cpython-85b0f5beb182cca8b1607accce2caab87ee29835.zip cpython-85b0f5beb182cca8b1607accce2caab87ee29835.tar.gz cpython-85b0f5beb182cca8b1607accce2caab87ee29835.tar.bz2 |
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 f442418..32f8a89 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); |