Index: Lib/gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.43 diff -u -r1.43 gzip.py --- Lib/gzip.py 3 Mar 2005 08:35:21 -0000 1.43 +++ Lib/gzip.py 8 Mar 2005 13:49:27 -0000 @@ -282,7 +282,12 @@ # this member, and read a new gzip header. # (The number of bytes to seek back is the length of the unused # data, minus 8 because _read_eof() will rewind a further 8 bytes) - self.fileobj.seek( -len(self.decompress.unused_data)+8, 1) + rewind = -len(self.decompress.unused_data)+8 + if rewind > 0: + # too few unused data encountered, assume EOF + errmsg = "Unexpected EOF: %r" % self.decompress.unused_data + raise EOFError, errmsg + self.fileobj.seek(rewind, 1) # Check the CRC and file size, and set the flag so we read # a new member on the next call