Repository navigation
Conversation
The getter of _last_mtime returned None when the stored time was 0, so a gzip header with a modification time of 0 read as None. Keep a separate flag that is set when the first header is read.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After reading a gzip file whose header has a modification time of 0,
IGzipFile.mtimeisNone.gzip.GzipFilegives 0, and so did python-isal 1.3.0. The getter of_GzipReader._last_mtimereturnsNonewhen the stored time is 0. That check came with the C reader in 1.4.0 (25e1449), where_last_mtimestarts at 0, and it makesmtimeNonebefore the first read, astest_mtimein the CPython tests expects. It cannot tell a time of 0 from a reader that has not read a header yet.RFC 1952 says that an MTIME of 0 means no time stamp is available, but the
gzipdocumentation describesmtimeafter a read as an integer, andgzip.GzipFilereturns 0. A modification time of 0 is common.gzip -n,python -m isal.igzip -n, andigzip_threadedwriters write it, and so doesgzip.compress()by default on Python 3.14. For example, on Python 3.14:This PR adds a flag to
_GzipReaderthat is set when it reads the first header, and the getter checks the flag.mtimeis stillNonebefore the first read. The newtest_igzipfile_mtimefails ondevelopfor a time of 0.Checklist