Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r61515:de6b3b05077e Date: 2013-02-20 16:11 -0800 http://bitbucket.org/pypy/pypy/changeset/de6b3b05077e/
Log: fix BufferedReader.seek to always check the underlying raw's seekability 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 @@ -266,6 +266,7 @@ raise operationerrfmt(space.w_ValueError, "whence must be between 0 and 2, not %d", whence) self._check_closed(space, "seek of closed file") + check_seekable_w(space, self.w_raw) if whence != 2 and self.readable: # Check if seeking leaves us inside the current buffer, so as to # return quickly if possible. Also, we needn't take the lock in 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 @@ -223,9 +223,12 @@ raise _io.UnsupportedOperation("not seekable") def tell(self, *args): raise _io.UnsupportedOperation("not seekable") - bufio = _io.BufferedReader(Unseekable()) + bufio = _io.BufferedReader(Unseekable(b"A" * 10)) raises(_io.UnsupportedOperation, bufio.tell) raises(_io.UnsupportedOperation, bufio.seek, 0) + bufio.read(1) + raises(_io.UnsupportedOperation, bufio.seek, 0) + raises(_io.UnsupportedOperation, bufio.tell) class AppTestBufferedReaderWithThreads(AppTestBufferedReader): spaceconfig = dict(usemodules=['_io', 'thread']) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit