This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhpvorderman
Recipients rhpvorderman
Date 2021-03-25.08:24:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616660684.49.0.0404853053479.issue43621@roundup.psfhosted.org>
In-reply-to
Content
This is properly documented: https://docs.python.org/3/library/gzip.html#gzip.BadGzipFile . 

It now hrows EOFErrors when a stream is truncated. But this means that upstream both BadGzipFile and EOFError need to be catched in the exception handling when opening a gzip file for reading. When a gzip file is truncated it is also a "bad gzip file" in my opinion, so there is no reason to have an extra class of errors.
Also it throws zlib.error's when zlib craches for some reason. This means there is some corruption in the raw deflate block. Well that means it is a "bad gzip file" as well and the error message should reflect that. 

This won't break people's code. If they are already catching EOFError zlib.error and BadGzipFile it changes nothing. If they only catch BadGzipFile, they will have less annoying errors that pop through.

I can make the PR, but of course not without any feedback. I am curious what other people think.
History
Date User Action Args
2021-03-25 08:24:44rhpvordermansetrecipients: + rhpvorderman
2021-03-25 08:24:44rhpvordermansetmessageid: <1616660684.49.0.0404853053479.issue43621@roundup.psfhosted.org>
2021-03-25 08:24:44rhpvordermanlinkissue43621 messages
2021-03-25 08:24:44rhpvordermancreate