diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-12 22:13:33 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-12 22:13:33 (GMT) |
commit | 7c4048918053e457eadaf76f2a1906d2cff879f2 (patch) | |
tree | 4e5bfb88addfef2422c47a031315b72075018348 /Modules/_io | |
parent | 0a42982316e0e64ac363e157eab43004b09f23c4 (diff) | |
download | cpython-7c4048918053e457eadaf76f2a1906d2cff879f2.zip cpython-7c4048918053e457eadaf76f2a1906d2cff879f2.tar.gz cpython-7c4048918053e457eadaf76f2a1906d2cff879f2.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 71c4052..25b91e3 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1749,7 +1749,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); |