diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-12 22:25:53 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-12 22:25:53 (GMT) |
commit | b89b31a1588b78f9c08ed8b4f5519571c2a44a42 (patch) | |
tree | b0b6151b7bb16c5835fc0049b02e140931365532 /Modules/_io | |
parent | 30536d1b77f78a049621d0fee873324be95b393a (diff) | |
parent | 00dd182b8ec1629a35cb6e9d551dedff6b7149f7 (diff) | |
download | cpython-b89b31a1588b78f9c08ed8b4f5519571c2a44a42.zip cpython-b89b31a1588b78f9c08ed8b4f5519571c2a44a42.tar.gz cpython-b89b31a1588b78f9c08ed8b4f5519571c2a44a42.tar.bz2 |
Issue #12062: Fix a flushing bug when doing a certain type of I/O sequence
on a file opened in read+write mode (namely: reading, seeking a bit forward,
writing, then seeking before the previous write but still within buffered
data, and writing again).
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/bufferedio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index dfe593f..3b8b7e9 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1894,7 +1894,7 @@ bufferedwriter_write(buffered *self, PyObject *args) avail = Py_SAFE_DOWNCAST(self->buffer_size - self->pos, Py_off_t, Py_ssize_t); if (buf.len <= avail) { memcpy(self->buffer + self->pos, buf.buf, buf.len); - if (!VALID_WRITE_BUFFER(self)) { + if (!VALID_WRITE_BUFFER(self) || self->write_pos > self->pos) { self->write_pos = self->pos; } ADJUST_POSITION(self, self->pos + buf.len); |