Author: Armin Rigo <[email protected]>
Branch:
Changeset: r61169:594758a6ff8b
Date: 2013-02-13 11:26 +0100
http://bitbucket.org/pypy/pypy/changeset/594758a6ff8b/
Log: merge heads
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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit