Skip to contentSkip to conversation

libselinux: Replace PyString_FromString with PyUnicode_FromString for SWIG 4.5.0 compatibility

PATCH In review Petr Lautrbach 2 participants 3 messages Aug 6 – Aug 7 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: 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.

---
 libselinux/src/selinuxswig_python.i | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
libselinux/src/selinuxswig_python.i +3 -3
index 03ed296d5b85..17a2620d46f7 100644
@@ -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);
Signature · 1 line
2.55.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Petr Lautrbach

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.

maintainer
#2 lore raw
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Petr Lautrbach

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.

Quoted 5 lines
Quoted 3 lines

Thanks, merged.