diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-04-11 07:48:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 07:48:40 (GMT) |
commit | cd8295ff758891f21084a6a5ad3403d35dda38f7 (patch) | |
tree | a77f829dea34198a7f36658c6e22baf4bc0bf5f5 /Modules/_io | |
parent | 7ec43a73092d43c6c95e7dd2669f49d54b57966f (diff) | |
download | cpython-cd8295ff758891f21084a6a5ad3403d35dda38f7.zip cpython-cd8295ff758891f21084a6a5ad3403d35dda38f7.tar.gz cpython-cd8295ff758891f21084a6a5ad3403d35dda38f7.tar.bz2 |
bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345)
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/textio.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index dedbefe..12dba38 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -340,7 +340,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself, goto error; kind = PyUnicode_KIND(modified); out = PyUnicode_DATA(modified); - PyUnicode_WRITE(kind, PyUnicode_DATA(modified), 0, '\r'); + PyUnicode_WRITE(kind, out, 0, '\r'); memcpy(out + kind, PyUnicode_DATA(output), kind * output_len); Py_DECREF(output); output = modified; /* output remains ready */ @@ -367,7 +367,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself, /* Record which newlines are read and do newline translation if desired, all in one pass. */ { - void *in_str; + const void *in_str; Py_ssize_t len; int seennl = self->seennl; int only_lf = 0; @@ -447,7 +447,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself, else { void *translated; int kind = PyUnicode_KIND(output); - void *in_str = PyUnicode_DATA(output); + const void *in_str = PyUnicode_DATA(output); Py_ssize_t in, out; /* XXX: Previous in-place translation here is disabled as resizing is not possible anymore */ @@ -2085,7 +2085,7 @@ _PyIO_find_line_ending( else { /* Non-universal mode. */ Py_ssize_t readnl_len = PyUnicode_GET_LENGTH(readnl); - Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl); + const Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl); /* Assume that readnl is an ASCII character. */ assert(PyUnicode_KIND(readnl) == PyUnicode_1BYTE_KIND); if (readnl_len == 1) { @@ -2139,7 +2139,7 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit) chunked = 0; while (1) { - char *ptr; + const char *ptr; Py_ssize_t line_len; int kind; Py_ssize_t consumed = 0; |