mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Patch #1355023: support whence argument for GzipFile.seek.
This commit is contained in:
parent
040a927cd1
commit
065f0c8a06
3 changed files with 19 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue