Commit ed554d12 authored by Guido van Rossum's avatar Guido van Rossum

Patch by Piet van Oostrum to avoid calculating with the result of

fp.tell() -- that won't work on Windows.

(A patch for rfc822 is still needed for one case where it finds a bad
header line and wants to back up.)
parent 723982b1
......@@ -52,8 +52,9 @@ class _Subfile:
elif length > remaining:
length = remaining
self.fp.seek(self.pos)
self.pos = self.pos + length
return self.fp.read(length)
data = self.fp.read(length)
self.pos = self.fp.tell()
return data
def readline(self, length = None):
if self.pos >= self.stop:
......@@ -62,9 +63,7 @@ class _Subfile:
length = self.stop - self.pos
self.fp.seek(self.pos)
data = self.fp.readline(length)
if len(data) < length:
length = len(data)
self.pos = self.pos + length
self.pos = self.fp.tell()
return data
def tell(self):
......@@ -79,7 +78,7 @@ class _Subfile:
self.pos = self.stop + pos
def close(self):
pass
del self.fp
class UnixMailbox(_Mailbox):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment