Commit a78e2b5c authored by Philip Jenvey's avatar Philip Jenvey

issue1902: fix a buffer flush thinko that rewound the raw stream twice

parent 9a52261a
......@@ -812,11 +812,6 @@ class BufferedMixin:
self._check_closed(space, "flush of closed file")
with self.lock:
self._flush_and_rewind_unlocked(space)
if self.readable:
# Rewind the raw stream so that its position corresponds to
# the current logical position.
self._raw_seek(space, -self._raw_offset(), 1)
self._reader_reset_buf()
def _flush_and_rewind_unlocked(self, space):
self._writer_flush_unlocked(space)
......
......@@ -352,3 +352,13 @@ class AppTestOpen:
assert mod == 'io'
else:
assert mod == '_io'
def test_issue1902(self):
import _io
with _io.open(self.tmpfile, 'w+b', 4096) as f:
f.write(b'\xff' * 13569)
f.flush()
f.seek(0, 0)
f.read(1)
f.seek(-1, 1)
f.write(b'')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment