summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index cf8b675..177f908 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -401,6 +401,9 @@ class GzipFile(_compression.BaseStream):
def seek(self, offset, whence=io.SEEK_SET):
if self.mode == WRITE:
+ self._check_not_closed()
+ # Flush buffer to ensure validity of self.offset
+ self._buffer.flush()
if whence != io.SEEK_SET:
if whence == io.SEEK_CUR:
offset = self.offset + offset