diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-11-12 10:41:39 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-11-12 10:41:39 (GMT) |
commit | 065f0c8a06e20c0b4f8c500c237cbafa7af7bd18 (patch) | |
tree | 65cb2e35ed1a4cee4c34e978aeb5053cc0fe0099 /Lib/gzip.py | |
parent | 040a927cd14e799454b246dd1f56fd7f4fdff03a (diff) | |
download | cpython-065f0c8a06e20c0b4f8c500c237cbafa7af7bd18.zip cpython-065f0c8a06e20c0b4f8c500c237cbafa7af7bd18.tar.gz cpython-065f0c8a06e20c0b4f8c500c237cbafa7af7bd18.tar.bz2 |
Patch #1355023: support whence argument for GzipFile.seek.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r-- | Lib/gzip.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py index 0bf29e8..c37d5a1 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -371,7 +371,12 @@ class GzipFile: self.extrasize = 0 self.offset = 0 - def seek(self, offset): + def seek(self, offset, whence=0): + if whence: + if whence == 1: + offset = self.offset + offset + else: + raise ValueError('Seek from end not supported') if self.mode == WRITE: if offset < self.offset: raise IOError('Negative seek in write mode') |