diff --git a/Lib/gzip.py b/Lib/gzip.py index 75c6ddc3f2cffb..a77ce7e0355e89 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -415,34 +415,75 @@ def _read_gzip_header(fp): Returns last mtime if header was present or None otherwise. ''' magic = fp.read(2) - if magic == b'': + if not magic: return None if magic != b'\037\213': raise BadGzipFile('Not a gzipped file (%r)' % magic) - - (method, flag, last_mtime) = struct.unpack("