Author: Philip Jenvey <pjen...@underboss.org> Branch: Changeset: r74282:60d682352d46 Date: 2014-10-29 12:38 -0700 http://bitbucket.org/pypy/pypy/changeset/60d682352d46/
Log: issue1902: fix a buffer flush thinko that rewound the raw stream twice diff --git a/pypy/module/_io/interp_bufferedio.py b/pypy/module/_io/interp_bufferedio.py --- a/pypy/module/_io/interp_bufferedio.py +++ b/pypy/module/_io/interp_bufferedio.py @@ -812,11 +812,6 @@ 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) diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py --- a/pypy/module/_io/test/test_io.py +++ b/pypy/module/_io/test/test_io.py @@ -352,3 +352,13 @@ 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'') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit