public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/libselinux] rawhide: Replace PyString_FromString with PyUnicode_FromString for SWIG 4.5.0 compatibility
@ 2026-08-07  6:59 Petr Lautrbach
  0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-08-07  6:59 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/libselinux
            Branch : rawhide
            Commit : 14e3c2c4da86e67ec73286242868a18e8b70e448
            Author : Petr Lautrbach <lautrbach@redhat.com>
            Date   : 2026-08-06T17:56:22+02:00
            Stats  : +57/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/libselinux/c/14e3c2c4da86e67ec73286242868a18e8b70e448?branch=rawhide

            Log:
            Replace PyString_FromString with PyUnicode_FromString for SWIG 4.5.0 compatibility

SWIG 4.5.0 removed Python 2 C API compatibility macros (PyInt_*,
PyString_*, SWIG_Python_str_*) from its runtime header pyhead.swg.
These macros previously mapped deprecated Python 2 C API names to their
Python 3 equivalents.

---
diff --git a/0002-libselinux-Replace-PyString_FromString-with-PyUnicod.patch b/0002-libselinux-Replace-PyString_FromString-with-PyUnicod.patch
new file mode 100644
index 0000000..7b19aba
--- /dev/null
+++ b/0002-libselinux-Replace-PyString_FromString-with-PyUnicod.patch
@@ -0,0 +1,56 @@
+From dc98eba184e63720cc53cc9b921e535c0951107d Mon Sep 17 00:00:00 2001
+From: Petr Lautrbach <lautrbach@redhat.com>
+Date: Thu, 6 Aug 2026 16:28:30 +0200
+Subject: [PATCH] libselinux: Replace PyString_FromString with
+ PyUnicode_FromString for SWIG 4.5.0 compatibility
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Content-type: text/plain
+
+SWIG 4.5.0 removed Python 2 C API compatibility macros (PyInt_*,
+PyString_*, SWIG_Python_str_*) from its runtime header pyhead.swg.
+These macros previously mapped deprecated Python 2 C API names to their
+Python 3 equivalents.
+
+Fixes: https://github.com/SELinuxProject/selinux/issues/538
+Authored-by: Jitka Plesníková <jplesnik@redhat.com>
+Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
+---
+ libselinux/src/selinuxswig_python.i | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i
+index 03ed296d5b85..17a2620d46f7 100644
+--- a/libselinux/src/selinuxswig_python.i
++++ b/libselinux/src/selinuxswig_python.i
+@@ -69,7 +69,7 @@ def install(src, dest):
+ 	PyObject* list = PyList_New(*$2);
+ 	int i;
+ 	for (i = 0; i < *$2; i++) {
+-		PyList_SetItem(list, i, PyString_FromString((*$1)[i]));
++		PyList_SetItem(list, i, PyUnicode_FromString((*$1)[i]));
+ 	}
+ 	$result = SWIG_AppendOutput($result, list);
+ }
+@@ -102,7 +102,7 @@ def install(src, dest):
+ 			len++;
+ 		plist = PyList_New(len);
+ 		for (i = 0; i < len; i++) {
+-			PyList_SetItem(plist, i, PyString_FromString((*$1)[i]));
++			PyList_SetItem(plist, i, PyUnicode_FromString((*$1)[i]));
+ 		}
+ 	} else {
+ 		plist = PyList_New(0);
+@@ -119,7 +119,7 @@ def install(src, dest):
+ 	if (*$1) {
+ 		plist = PyList_New(result);
+ 		for (i = 0; i < result; i++) {
+-			PyList_SetItem(plist, i, PyString_FromString((*$1)[i]));
++			PyList_SetItem(plist, i, PyUnicode_FromString((*$1)[i]));
+ 		}
+ 	} else {
+ 		plist = PyList_New(0);
+-- 
+2.55.0
+

diff --git a/libselinux.spec b/libselinux.spec
index d453257..828a45f 100644
--- a/libselinux.spec
+++ b/libselinux.spec
@@ -20,6 +20,7 @@ Url: https://github.com/SELinuxProject/selinux/wiki
 # $ i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done
 # Patch list start
 Patch0001: 0001-Use-SHA-2-instead-of-SHA-1.patch
+Patch0002: 0002-libselinux-Replace-PyString_FromString-with-PyUnicod.patch
 # Patch list end
 BuildRequires: gcc make
 BuildRequires: ruby-devel ruby libsepol-static >= %{libsepolver} swig pcre2-devel

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

only message in thread, other threads:[~2026-08-07  6:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-07  6:59 [rpms/libselinux] rawhide: Replace PyString_FromString with PyUnicode_FromString for SWIG 4.5.0 compatibility Petr Lautrbach

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