From 45828be21dc8ef94c81d86f9a298aebe986a22f2 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Tue, 25 Aug 2026 16:39:55 +0200 Subject: [PATCH] Fix build failure with SWIG 4.5 and Python 3.13 - Include "compat.h" in ytypes.i to define missing Python 2 compatibility macros (e.g., PyInt_Check, PyString_Check) which were removed in SWIG 4.5. - Replace the internal and removed _PyUnicode_AsString with PyUnicode_AsUTF8 for standard Python 3 Unicode conversion. --- package/yast2-python-bindings.changes | 6 ++++++ package/yast2-python-bindings.spec | 2 +- src/ytypes.i | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package/yast2-python-bindings.changes b/package/yast2-python-bindings.changes index 3b20308..8d5314c 100644 --- a/package/yast2-python-bindings.changes +++ b/package/yast2-python-bindings.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 25 14:41:32 UTC 2026 - Dominique Leuenberger + +- Fix build failure with SWIG 4.5 and Python 3.13 (boo#1275515) +- 5.0.3 + ------------------------------------------------------------------- Mon Nov 13 09:44:31 UTC 2023 - Noel Power diff --git a/package/yast2-python-bindings.spec b/package/yast2-python-bindings.spec index 102c475..b299535 100644 --- a/package/yast2-python-bindings.spec +++ b/package/yast2-python-bindings.spec @@ -23,7 +23,7 @@ %bcond_with python2 %endif Name: yast2-python-bindings -Version: 5.0.2 +Version: 5.0.3 Release: 0 Summary: Python bindings for the YaST platform License: GPL-2.0-only diff --git a/src/ytypes.i b/src/ytypes.i index d0149bc..e2815a7 100644 --- a/src/ytypes.i +++ b/src/ytypes.i @@ -1,4 +1,6 @@ %{ +#include "compat.h" + YCPValue pyval_to_ycp(PyObject *input) { int ret; @@ -24,7 +26,7 @@ YCPValue pyval_to_ycp(PyObject *input) return YCPString(PyString_AsString(input)); if (PyUnicode_Check(input)) { #if PY_MAJOR_VERSION >= 3 - return YCPString(_PyUnicode_AsString(input)); + return YCPString(PyUnicode_AsUTF8(input)); #else PyObject* encoded = PyUnicode_AsEncodedString(input, "utf8", NULL); return YCPString(PyBytes_AsString(encoded));