diff options
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 49fbe19f32..a1c21d311c 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -867,7 +867,7 @@ class BytesIO(BufferedIOBase): elif pos < 0: raise ValueError("negative truncate position %r" % (pos,)) del self._buffer[pos:] - return self.seek(pos) + return pos def readable(self): return True @@ -1226,8 +1226,7 @@ class BufferedRandom(BufferedWriter, BufferedReader): if pos is None: pos = self.tell() # Use seek to flush the read buffer. - self.seek(pos) - return BufferedWriter.truncate(self) + return BufferedWriter.truncate(self, pos) def read(self, n=None): if n is None: @@ -1727,8 +1726,7 @@ class TextIOWrapper(TextIOBase): self.flush() if pos is None: pos = self.tell() - self.seek(pos) - return self.buffer.truncate() + return self.buffer.truncate(pos) def detach(self): if self.buffer is None: |