-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gzip module has no custom exception #50833
Comments
Much like zipfile.BadZipfile, we need a base custom exception for the See the following example (the exception escaped the "try... except [...] |
Unless something in the docs claims that there is/should be such a |
I have created a small patch, that introduces BadGzipFile exception. It is a subclass of IOError, so it would be backward compatible and will be still caught by old code, but this way is distinct from IOError. |
Modified patch with test, that catches both BadGzipFile and IOError exceptions. |
Bump! How about commiting this patch? Or maybe there is something missing? I'll be happy to fix it. |
Since the patch makes BadGzipFile a subclass of IOError, it doesn't look unreasonable.
|
I'll be very happy to fix this after Friday. Thanks for your comments. |
I had some time today, so I managed to fix the patch. I hope now everything is ok. |
Bump! Antoine, do you think the patch is acceptable and can be committed now? |
Your changes appear to address all three of Antoine's 'nits'. |
Ezio has found a few other things to improve (follow the “review” link to the right of the patch link). |
The attached patch follows Ezio's hints. |
The new exception should also be documented, and a versionadded and Doc/whatsnew/3.4.rst entry added. |
done! |
Not all invalid gzip files raise BadGzipFile. Some of them raises ZlibError. |
Well, I specified the word For reading and writing .gz files see the gzip module. Also, I specified 'the gzip module' on the whatsnew section. |
I added some comments on Rietveld. |
I'd like to see this issue move forward, so I've created a PR. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: