public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-nibabel] rawhide: Fix compatibility with Python 3.15
@ 2026-06-03  9:53 Karolina Surma
  0 siblings, 0 replies; only message in thread
From: Karolina Surma @ 2026-06-03  9:53 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-nibabel
Branch : rawhide
Commit : c7bd9939e666b7041895e9c05deacda01e78e936
Author : Karolina Surma <ksurma@redhat.com>
Date   : 2026-05-22T11:39:06+02:00
Stats  : +69/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-nibabel/c/c7bd9939e666b7041895e9c05deacda01e78e936?branch=rawhide

Log:
Fix compatibility with Python 3.15

---
diff --git a/1509.patch b/1509.patch
new file mode 100644
index 0000000..88d48d3
--- /dev/null
+++ b/1509.patch
@@ -0,0 +1,60 @@
+From 33c8ff292b8da87da835a88f2dee6a81b0cf088b Mon Sep 17 00:00:00 2001
+From: Karolina Surma <ksurma@redhat.com>
+Date: Fri, 22 May 2026 11:24:36 +0200
+Subject: [PATCH] Set the compression level to match one of the running
+ Python's
+
+---
+ nibabel/_compression.py | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/nibabel/_compression.py b/nibabel/_compression.py
+index 251faae1d..431dca25e 100644
+--- a/nibabel/_compression.py
++++ b/nibabel/_compression.py
+@@ -82,7 +82,7 @@ def __init__(
+         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,23 @@ def __init__(
+                 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))
++        # Only forward compresslevel when explicitly set; None defers to Python's runtime default
++        compress_kwargs: dict[str, int] = {}
++        if compresslevel is not None:
++            compress_kwargs['compresslevel'] = compresslevel
+         super().__init__(
+             filename='',
+             mode=modestr,
+-            compresslevel=compresslevel,
+             fileobj=fileobj,
+             mtime=mtime,
++            **compress_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:
+@@ -130,8 +134,8 @@ def gzip_open(
+         Path of file to open.
+     mode : str
+         Opening mode - either ``rb`` or ``wb``.
+-    compresslevel: int
+-        Compression level when writing.
++    compresslevel: int | None
++        Compression level when writing. If None, the running Python's default is used.
+     mtime: int
+         Modification time used when writing a file - passed to the
+         ``DetemrinisticGzipFile``. Ignored when reading.

diff --git a/python-nibabel.spec b/python-nibabel.spec
index ceeeded..5dc9027 100644
--- a/python-nibabel.spec
+++ b/python-nibabel.spec
@@ -25,6 +25,15 @@ License:        MIT and PDDL-1.0
 URL:            http://nipy.org/nibabel/
 Source0:        %forgesource
 
+# fix: Set the compression level to match one of the running Python's
+# Proposed upstream: https://github.com/nipy/nibabel/pull/1509
+#
+# Fixes:
+#
+# compatibility with Python 3.15
+# https://github.com/nipy/nibabel/issues/1477
+Patch:          https://github.com/nipy/nibabel/pull/1509.patch
+
 BuildArch:      noarch
 
 %description %_description

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-03  9:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03  9:53 [rpms/python-nibabel] rawhide: Fix compatibility with Python 3.15 Karolina Surma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox