Skip to content

Keep isal_zlib importable with ISA-L 2.30, which Read the Docs uses - #273

Merged
rhpvorderman merged 2 commits into
pycompression:developfrom
ptweezy:isal-2.30-compat
Oct 19, 2026
Merged

rhpvorderman merged 2 commits into
pycompression:developfrom
ptweezy:isal-2.30-compat

Conversation

@ptweezy

@ptweezy ptweezy commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

For the "Check latest documentation looks fine" step in #267.

On https://python-isal.readthedocs.io/en/latest/, the API documentation for isal_zlib, igzip and igzip_threaded is empty. Read the Docs builds on Ubuntu 22.04 (build.os in .readthedocs.yml), which installs libisal 2.30.0. The log of the latest build shows:

isal_zlib.cpython-314-x86_64-linux-gnu.so: undefined symbol: isal_zlib_header_init
WARNING: autodoc: failed to import module 'isal_zlib' from module 'isal'

isal_zlib_header_init was added in ISA-L 2.31. It is called by the preset dictionary fix from #257, so this started after 1.8.0. Anyone who links dynamically against ISA-L 2.30, for example on Debian bookworm or Ubuntu 22.04, gets the same ImportError. The 1.9.0 tag would have the same empty API pages.

This PR:

  1. Removes the isal_zlib_header_init call. The function only sets the four fields of struct isal_zlib_header to zero, and the next four lines set all of them. ISA-L 2.30 already has the struct and isal_write_zlib_header.
  2. Runs the docs and twine_check jobs on ubuntu-22.04, the same release as build.os. The docs job runs sphinx-build -W, so it fails when a module cannot be imported on Read the Docs. On ubuntu-latest it got libisal 2.31, which is why CI did not catch this.

Results with each build linked dynamically against the distribution's libisal, in containers:

Build libisal Import sphinx-build -W Tests
develop, Debian bookworm, CPython 3.14.8 2.30.0 undefined symbol fails
This PR, Debian bookworm, CPython 3.14.8 2.30.0 works passes 9304 passed, 216 failed
1.8.0 with its own tests, Debian bookworm, CPython 3.14.8 2.30.0 works passes 9107 passed, 216 failed
This PR, Ubuntu 24.04, CPython 3.12.3 2.31.0 works passes 9520 passed

The 216 failures are the same on 1.8.0 and on this PR. They are all in test_compat.py::test_compress_compressobj with wbits 9 to 14. ISA-L 2.30 always writes a window size of 32 KiB (CINFO 7) in the zlib header, and CPython's zlib.decompress rejects that when wbits is smaller. So this PR does not make ISA-L 2.30 work fully. It restores the 1.8.0 behavior, so the modules import and the documentation builds.

If you would rather require ISA-L 2.31, setting build.os to ubuntu-24.04 (libisal 2.31.0) also fixes Read the Docs, but dynamic builds against 2.30 would still fail at import.

There is no CHANGELOG entry, because no release has this problem.

Checklist

  • Pull request details were added to CHANGELOG.rst (not needed: no release has this problem)
  • Documentation was updated (if needed)

isal_zlib_header_init was added in ISA-L 2.31. Read the Docs builds on
Ubuntu 22.04, which ships libisal 2.30, so isal_zlib failed to import
there and the API documentation for isal_zlib, igzip and igzip_threaded
was empty. The function only zeroes the four fields of the struct, and
all four are set right after the call, so it is not needed.

Run the docs check on the same Ubuntu release as Read the Docs so CI
catches this kind of breakage.
@ptweezy
ptweezy marked this pull request as ready for review October 18, 2026 16:35
@rhpvorderman
rhpvorderman merged commit f4a0c23 into pycompression:develop Oct 19, 2026
22 checks passed
@ptweezy
ptweezy deleted the isal-2.30-compat branch October 20, 2026 13:39
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.

2 participants