mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Merged revisions 83944 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83944 | antoine.pitrou | 2010-08-11 15:31:33 +0200 (mer., 11 août 2010) | 6 lines Issue #9550: a BufferedReader could issue an additional read when the original read request had been satisfied, which can block indefinitely when the underlying raw IO channel is e.g. a socket. Report and original patch by Jason V. Miller. ........
This commit is contained in:
parent
91ecc5667f
commit
00091cada6
4 changed files with 34 additions and 1 deletions
|
|
@ -1379,7 +1379,10 @@ _bufferedreader_read_generic(buffered *self, Py_ssize_t n)
|
|||
self->pos = 0;
|
||||
self->raw_pos = 0;
|
||||
self->read_end = 0;
|
||||
while (self->read_end < self->buffer_size) {
|
||||
/* NOTE: when the read is satisfied, we avoid issuing any additional
|
||||
reads, which could block indefinitely (e.g. on a socket).
|
||||
See issue #9550. */
|
||||
while (remaining > 0 && self->read_end < self->buffer_size) {
|
||||
Py_ssize_t r = _bufferedreader_fill_buffer(self);
|
||||
if (r == -1)
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue