bpo-33361: Fix bug with seeking in StreamRecoders (GH-8278)

This commit is contained in:
Ammar Askar 2019-05-31 12:44:01 -07:00 committed by Berker Peksag
parent aac4d0342c
commit a6ec1ce1ac
3 changed files with 33 additions and 0 deletions

View file

@ -847,6 +847,12 @@ class StreamRecoder:
self.reader.reset()
self.writer.reset()
def seek(self, offset, whence=0):
# Seeks must be propagated to both the readers and writers
# as they might need to reset their internal buffers.
self.reader.seek(offset, whence)
self.writer.seek(offset, whence)
def __getattr__(self, name,
getattr=getattr):