summaryrefslogtreecommitdiffstats
path: root/Lib/codecs.py
diff options
context:
space:
mode:
authorAmmar Askar <ammar_askar@hotmail.com>2019-05-31 19:44:01 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2019-05-31 19:44:00 (GMT)
commita6ec1ce1ac05b1258931422e96eac215b6a05459 (patch)
tree55a15df467b1e34a37f408524035495e4572c502 /Lib/codecs.py
parentaac4d0342c3e692731c189d003dbd73a8c681a34 (diff)
downloadcpython-a6ec1ce1ac05b1258931422e96eac215b6a05459.zip
cpython-a6ec1ce1ac05b1258931422e96eac215b6a05459.tar.gz
cpython-a6ec1ce1ac05b1258931422e96eac215b6a05459.tar.bz2
bpo-33361: Fix bug with seeking in StreamRecoders (GH-8278)
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r--Lib/codecs.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index 884be0b..21c45a7 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -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):