diff options
| author | Larry Hastings <larry@hastings.org> | 2015-09-04 05:12:08 (GMT) |
|---|---|---|
| committer | Larry Hastings <larry@hastings.org> | 2015-09-04 05:12:08 (GMT) |
| commit | 9f9a00afc028023cb67bc577606587fc163f7f2b (patch) | |
| tree | fb16fde4cd18a51a2d340b91ddf27092dbc10eda /Modules/_io/bytesio.c | |
| parent | a43de00b74e458a2dd965a82c32b879c5084a490 (diff) | |
| parent | 4e63f7a2b4e3602c420c8ae59a16020b14f8ee13 (diff) | |
| download | cpython-9f9a00afc028023cb67bc577606587fc163f7f2b.zip cpython-9f9a00afc028023cb67bc577606587fc163f7f2b.tar.gz cpython-9f9a00afc028023cb67bc577606587fc163f7f2b.tar.bz2 | |
Merged in storchaka/cpython350 (pull request #13)
Issue #24989
Diffstat (limited to 'Modules/_io/bytesio.c')
| -rw-r--r-- | Modules/_io/bytesio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index d46430d..31cc1f7 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -57,14 +57,18 @@ scan_eol(bytesio *self, Py_ssize_t len) Py_ssize_t maxlen; assert(self->buf != NULL); + assert(self->pos >= 0); + + if (self->pos >= self->string_size) + return 0; /* Move to the end of the line, up to the end of the string, s. */ - start = PyBytes_AS_STRING(self->buf) + self->pos; maxlen = self->string_size - self->pos; if (len < 0 || len > maxlen) len = maxlen; if (len) { + start = PyBytes_AS_STRING(self->buf) + self->pos; n = memchr(start, '\n', len); if (n) /* Get the length from the current position to the end of |
