mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
This commit is contained in:
parent
a98c4a984b
commit
85b0f5beb1
29 changed files with 60 additions and 61 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue