Package: src:nibabel Version: 5.4.2-4 User: [email protected] Usertags: python3.15 Tags: patch, ftbfs, forky, sid Severity: important
Hi! While rebuilding the python related packages against the Python 3.15rc2 version we found that nibabel fails to build from source [1]. The failure happens because test_DeterministicGzipFile and test_DeterministicGzipFile_fileobj fail due to a discrepancy in the default compression levels of gzip files, python 3.15 uses now compresslevel=6 To fix this, I've made a patch to use None as the default compresslevel, and let Python set it, instead of forcing it to 9. I applied the fix in the sandbox [2] to be able to build the packages that depend on nibabel, please consider applying the patch to support the upcoming 3.15 version. Setting the severity to important for now. Once Python 3.15 is released, it will be added to python3-defaults and this bug will become release critical. Happy hacking, [1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4478755/ [2]: https://debusine.debian.net/debian/r-python-python3.15/ -- "Can you imagine what I would do if I could do all I can?" -- Sun Tzu Saludos /\/\ /\ >< `/
Description: Fix test failures with Python 3.15 In Python 3.15, gzip.GzipFile changed its default compresslevel from 9 to 6. Allow DeterministicGzipFile to inherit the default compresslevel from GzipFile when unspecified instead of hardcoding 9. Author: Maximiliano Curia <[email protected]> Forwarded: no --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: nibabel/nibabel/_compression.py =================================================================== --- nibabel.orig/nibabel/_compression.py +++ nibabel/nibabel/_compression.py @@ -82,7 +82,7 @@ class DeterministicGzipFile(gzip.GzipFil self, filename: str | None = None, mode: Mode | None = None, - compresslevel: int = 9, + compresslevel: int | None = None, fileobj: io.FileIO | None = None, mtime: int = 0, ): @@ -99,19 +99,22 @@ class DeterministicGzipFile(gzip.GzipFil raise TypeError('Must define either fileobj or filename') # Cast because GzipFile.myfileobj has type io.FileIO while open returns ty.IO fileobj = self.myfileobj = ty.cast('io.FileIO', open(filename, modestr)) + kwargs = {} + if compresslevel is not None: + kwargs['compresslevel'] = compresslevel super().__init__( filename='', mode=modestr, - compresslevel=compresslevel, fileobj=fileobj, mtime=mtime, + **kwargs, ) def gzip_open( filename: str, mode: Mode = 'rb', - compresslevel: int = 9, + compresslevel: int | None = None, mtime: int = 0, keep_open: bool = False, ) -> gzip.GzipFile:

