Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f7b8cb6

Browse files
author
Victor Stinner
committed
_io.textio: fix character type, use Py_UCS4 instead of Py_UNICODE
1 parent 0058b86 commit f7b8cb6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/_io/textio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *_self,
347347
memchr(in_str, '\n', PyUnicode_KIND_SIZE(kind, len)) != NULL) {
348348
Py_ssize_t i = 0;
349349
for (;;) {
350-
Py_UNICODE c;
350+
Py_UCS4 c;
351351
/* Fast loop for non-control characters */
352352
while (PyUnicode_READ(kind, in_str, i) > '\n')
353353
i++;
@@ -1570,7 +1570,7 @@ textiowrapper_read(textio *self, PyObject *args)
15701570
}
15711571

15721572

1573-
/* NOTE: `end` must point to the real end of the Py_UNICODE storage,
1573+
/* NOTE: `end` must point to the real end of the Py_UCS4 storage,
15741574
that is to the NUL character. Otherwise the function will produce
15751575
incorrect results. */
15761576
static char *
@@ -1614,7 +1614,7 @@ _PyIO_find_line_ending(
16141614
for (;;) {
16151615
Py_UCS4 ch;
16161616
/* Fast path for non-control chars. The loop always ends
1617-
since the Py_UNICODE storage is NUL-terminated. */
1617+
since the Unicode string is NUL-terminated. */
16181618
while (PyUnicode_READ(kind, s, 0) > '\r')
16191619
s += size;
16201620
if (s >= end) {

0 commit comments

Comments
 (0)