_io.textio: fix character type, use Py_UCS4 instead of Py_UNICODE

This commit is contained in:
Victor Stinner 2011-09-29 03:28:17 +02:00
parent 0058b8603f
commit f7b8cb605d
1 changed files with 3 additions and 3 deletions

View File

@ -347,7 +347,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *_self,
memchr(in_str, '\n', PyUnicode_KIND_SIZE(kind, len)) != NULL) { memchr(in_str, '\n', PyUnicode_KIND_SIZE(kind, len)) != NULL) {
Py_ssize_t i = 0; Py_ssize_t i = 0;
for (;;) { for (;;) {
Py_UNICODE c; Py_UCS4 c;
/* Fast loop for non-control characters */ /* Fast loop for non-control characters */
while (PyUnicode_READ(kind, in_str, i) > '\n') while (PyUnicode_READ(kind, in_str, i) > '\n')
i++; i++;
@ -1570,7 +1570,7 @@ textiowrapper_read(textio *self, PyObject *args)
} }
/* NOTE: `end` must point to the real end of the Py_UNICODE storage, /* NOTE: `end` must point to the real end of the Py_UCS4 storage,
that is to the NUL character. Otherwise the function will produce that is to the NUL character. Otherwise the function will produce
incorrect results. */ incorrect results. */
static char * static char *
@ -1614,7 +1614,7 @@ _PyIO_find_line_ending(
for (;;) { for (;;) {
Py_UCS4 ch; Py_UCS4 ch;
/* Fast path for non-control chars. The loop always ends /* Fast path for non-control chars. The loop always ends
since the Py_UNICODE storage is NUL-terminated. */ since the Unicode string is NUL-terminated. */
while (PyUnicode_READ(kind, s, 0) > '\r') while (PyUnicode_READ(kind, s, 0) > '\r')
s += size; s += size;
if (s >= end) { if (s >= end) {