public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-zlib-ng] f43: Fix segmentation fault when building with Python 3.15
@ 2026-11-04 6:37 Karolina Surma
0 siblings, 0 replies; only message in thread
From: Karolina Surma @ 2026-11-04 6:37 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-zlib-ng
Branch : f43
Commit : f96c990ca6e726d87c96e5b9b015c515d74534fa
Author : Karolina Surma <ksurma@redhat.com>
Date : 2026-05-20T15:45:17+02:00
Stats : +42/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-zlib-ng/c/f96c990ca6e726d87c96e5b9b015c515d74534fa?branch=f43
Log:
Fix segmentation fault when building with Python 3.15
---
diff --git a/0001-Fix-crash-when-copying-flushed-compress-objects.patch b/0001-Fix-crash-when-copying-flushed-compress-objects.patch
new file mode 100644
index 0000000..191c498
--- /dev/null
+++ b/0001-Fix-crash-when-copying-flushed-compress-objects.patch
@@ -0,0 +1,39 @@
+From 7f818db5343887f17923c37a36e82c41ef933b5e Mon Sep 17 00:00:00 2001
+From: Karolina Surma <ksurma@redhat.com>
+Date: Mon, 20 Apr 2026 17:37:04 +0200
+Subject: [PATCH] Fix crash when copying flushed compress objects
+
+The error path in zlib_Compress_copy() called LEAVE_ZLIB(self) via the
+error label even when ENTER_ZLIB(self) was never called. This happened
+when is_initialised is false (object already flushed), causing an
+unlock of a mutex that was never locked.
+
+On Python 3.15, PyThread_release_lock() now uses PyMutex_Unlock()
+(gh-134745) which fatally aborts on unlocking an unheld mutex, turning
+this latent bug into a crash (SIGABRT).
+
+Fix by returning directly instead of jumping to the error label that
+assumes the lock is held.
+
+Assisted-By: Claude 4.6 Sonnet
+---
+ src/zlib_ng/zlib_ngmodule.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/zlib_ng/zlib_ngmodule.c b/src/zlib_ng/zlib_ngmodule.c
+index ea71d53..c8c2a32 100644
+--- a/src/zlib_ng/zlib_ngmodule.c
++++ b/src/zlib_ng/zlib_ngmodule.c
+@@ -801,7 +801,8 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
+
+ if (!self->is_initialised) {
+ PyErr_SetString(PyExc_ValueError, "Cannot copy flushed objects.");
+- goto error;
++ Py_DECREF(return_value);
++ return NULL;
+ }
+
+ /* Copy the zstream state
+--
+2.53.0
+
diff --git a/python-zlib-ng.spec b/python-zlib-ng.spec
index b6e1922..d15aeb6 100644
--- a/python-zlib-ng.spec
+++ b/python-zlib-ng.spec
@@ -10,6 +10,9 @@ License: PSF-2.0
URL: https://github.com/pycompression/python-zlib-ng
Source: %{url}/archive/v%{version}/python-zlib-ng-%{version}.tar.gz
+# https://github.com/pycompression/python-zlib-ng/issues/75
+Patch: 0001-Fix-crash-when-copying-flushed-compress-objects.patch
+
BuildSystem: pyproject
BuildOption(install): --assert-license zlib_ng
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-04 6:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 6:37 [rpms/python-zlib-ng] f43: Fix segmentation fault when building 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