Skip to content

Test gzip headers with a header CRC and seek() calls from the end before a read - #299

Open
ptweezy wants to merge 1 commit into
pycompression:developfrom
ptweezy:test-header-crc-seek-end
Open

ptweezy wants to merge 1 commit into
pycompression:developfrom
ptweezy:test-header-crc-seek-end

Conversation

@ptweezy

@ptweezy ptweezy commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Two paths in the C code of _GzipReader have no test:

  • Reading a gzip header with a valid header CRC (FHCRC). _GzipReader checks this CRC, and gzip does not. The headers() helper in tests/test_igzip.py builds such headers, but no test has used it since 2c4de51 removed test_read_gzip_header_position together with the Python header parser.
  • A seek() call from the end while the size is not known yet, which makes seek() decompress all of the data first. test_seek reads before it seeks from the end, and that read reaches the end of its 4,000 bytes, so the size is already known.

The new tests read each header from headers() and seek from the end of a fresh file. Both pass on develop.

This PR changes only tests, so it has no CHANGELOG entry.

Checklist

  • Pull request details were added to CHANGELOG.rst
  • Documentation was updated (if needed)

…read

No test read a valid header with FHCRC, which _GzipReader checks: the
headers() helper lost its only test in 2c4de51. test_seek reads before
it seeks from the end, so seek() never had to find the size.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant