mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13087: BufferedReader.seek() now always raises UnsupportedOperation
if the underlying raw stream is unseekable, even if the seek could be satisfied using the internal buffer. Patch by John OConnor.
This commit is contained in:
commit
bf009f0bce
3 changed files with 15 additions and 0 deletions
|
@ -928,6 +928,14 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
|
|||
finally:
|
||||
support.unlink(support.TESTFN)
|
||||
|
||||
def test_unseekable(self):
|
||||
bufio = self.tp(self.MockUnseekableIO(b"A" * 10))
|
||||
self.assertRaises(self.UnsupportedOperation, bufio.tell)
|
||||
self.assertRaises(self.UnsupportedOperation, bufio.seek, 0)
|
||||
bufio.read(1)
|
||||
self.assertRaises(self.UnsupportedOperation, bufio.seek, 0)
|
||||
self.assertRaises(self.UnsupportedOperation, bufio.tell)
|
||||
|
||||
def test_misbehaved_io(self):
|
||||
rawio = self.MisbehavedRawIO((b"abc", b"d", b"efg"))
|
||||
bufio = self.tp(rawio)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue