[pypy-commit] pypy default: a test and fix for a problem induced by the _io changes
bdkearns
noreply at buildbot.pypy.org
Wed Feb 13 09:39:03 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r61163:5304bc773a43
Date: 2013-02-13 03:38 -0500
http://bitbucket.org/pypy/pypy/changeset/5304bc773a43/
Log: a test and fix for a problem induced by the _io changes
diff --git a/lib-python/conftest.py b/lib-python/conftest.py
--- a/lib-python/conftest.py
+++ b/lib-python/conftest.py
@@ -272,7 +272,7 @@
RegrTest('test_inspect.py'),
RegrTest('test_int.py', core=True),
RegrTest('test_int_literal.py', core=True),
- RegrTest('test_io.py'),
+ RegrTest('test_io.py', usemodules='array binascii'),
RegrTest('test_ioctl.py'),
RegrTest('test_isinstance.py', core=True),
RegrTest('test_iter.py', core=True),
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
@@ -260,7 +260,7 @@
raise operationerrfmt(space.w_ValueError,
"whence must be between 0 and 2, not %d", whence)
self._check_closed(space, "seek of closed file")
- if whence != 2 and self.readable:
+ if whence != 2 and self.readable and self.read_end != -1:
# Check if seeking leaves us inside the current buffer, so as to
# return quickly if possible. Also, we needn't take the lock in
# this fast path.
diff --git a/pypy/module/_io/test/test_bufferedio.py b/pypy/module/_io/test/test_bufferedio.py
--- a/pypy/module/_io/test/test_bufferedio.py
+++ b/pypy/module/_io/test/test_bufferedio.py
@@ -570,6 +570,14 @@
f.seek(0)
assert f.read() == 'a\nbxxxx'
+ def test_simple_read_after_write(self):
+ import _io
+ raw = _io.FileIO(self.tmpfile, 'wb+')
+ f = _io.BufferedRandom(raw)
+ f.write('abc')
+ f.seek(0)
+ assert f.read() == 'abc'
+
def test_write_rewind_write(self):
# Various combinations of reading / writing / seeking
# backwards / writing again
More information about the pypy-commit
mailing list