support 'whence' arg to seek()
This commit is contained in:
parent
0eaa74bf8d
commit
44a4d59b56
|
@ -12,8 +12,13 @@ class _Mailbox:
|
||||||
self.fp = fp
|
self.fp = fp
|
||||||
self.seekp = 0
|
self.seekp = 0
|
||||||
|
|
||||||
def seek(self, pos):
|
def seek(self, pos, whence=0):
|
||||||
self.seekp = pos
|
if whence==1: # Relative to current position
|
||||||
|
self.pos = self.pos + pos
|
||||||
|
if whence==2: # Relative to file's end
|
||||||
|
self.pos = self.stop + pos
|
||||||
|
else: # Default - absolute position
|
||||||
|
self.pos = self.start + pos
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
while 1:
|
while 1:
|
||||||
|
|
Loading…
Reference in New Issue