public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jitka Plesnikova <jplesnik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/openwsman] rawhide: Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
Date: Thu, 30 Jul 2026 08:13:44 GMT	[thread overview]
Message-ID: <178539922491.1.16326702063459635677.rpms-openwsman-4b080cc4f063@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/openwsman
Branch : rawhide
Commit : 4b080cc4f06302d26938b13b03eb6d8b3be1d662
Author : Jitka Plesnikova <jplesnik@redhat.com>
Date   : 2026-07-28T15:29:18+02:00
Stats  : +130/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/openwsman/c/4b080cc4f06302d26938b13b03eb6d8b3be1d662?branch=rawhide

Log:
Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility

---
diff --git a/openwsman-swig45.patch b/openwsman-swig45.patch
new file mode 100644
index 0000000..e336065
--- /dev/null
+++ b/openwsman-swig45.patch
@@ -0,0 +1,123 @@
+diff -up openwsman-2.8.1/bindings/openwsman.i.swig45 openwsman-2.8.1/bindings/openwsman.i
+--- openwsman-2.8.1/bindings/openwsman.i.swig45	2026-07-28 10:18:09.210652643 +0200
++++ openwsman-2.8.1/bindings/openwsman.i	2026-07-28 10:18:09.226768239 +0200
+@@ -12,9 +12,9 @@
+ #define Target_Null Py_None
+ #define Target_Type PyObject*
+ #define Target_Bool(x) PyBool_FromLong(x)
+-#define Target_Char16(x) PyInt_FromLong(x)
+-#define Target_Int(x) PyInt_FromLong(x)
+-#define Target_String(x) PyString_FromString(x)
++#define Target_Char16(x) PyLong_FromLong(x)
++#define Target_Int(x) PyLong_FromLong(x)
++#define Target_String(x) PyUnicode_FromString(x)
+ #define Target_Real(x) Py_None
+ #define Target_Array() PyList_New(0)
+ #define Target_SizedArray(len) PyList_New(len)
+diff -up openwsman-2.8.1/bindings/python/helpers.h.swig45 openwsman-2.8.1/bindings/python/helpers.h
+--- openwsman-2.8.1/bindings/python/helpers.h.swig45	2026-07-28 10:18:09.209652621 +0200
++++ openwsman-2.8.1/bindings/python/helpers.h	2026-07-28 10:18:09.226229990 +0200
+@@ -102,10 +102,10 @@ auth_request_callback( WsManClient *clie
+     }
+     puser = PyTuple_GetItem(prv, 0); 
+     ppass = PyTuple_GetItem(prv, 0); 
+-    if (PyString_Check(puser) && PyString_Check(ppass))
++    if (PyBytes_Check(puser) && PyBytes_Check(ppass))
+     {
+-        *username = strdup(PyString_AsString(puser));
+-        *password = strdup(PyString_AsString(ppass));
++        *username = strdup(PyBytes_AsString(puser));
++        *password = strdup(PyBytes_AsString(ppass));
+     }
+ 
+ cleanup:
+diff -up openwsman-2.8.1/src/plugins/swig/plugin.i.swig45 openwsman-2.8.1/src/plugins/swig/plugin.i
+--- openwsman-2.8.1/src/plugins/swig/plugin.i.swig45	2026-07-28 10:18:09.220652856 +0200
++++ openwsman-2.8.1/src/plugins/swig/plugin.i	2026-07-28 10:18:09.227653381 +0200
+@@ -76,9 +76,9 @@
+ #define Target_Void Py_None
+ typedef PyObject * Target_Type;
+ #define Target_Bool(x) PyBool_FromLong(x)
+-#define Target_WChar(x) PyInt_FromLong(x)
+-#define Target_Int(x) PyInt_FromLong(x)
+-#define Target_String(x) PyString_FromString(x)
++#define Target_WChar(x) PyLong_FromLong(x)
++#define Target_Int(x) PyLong_FromLong(x)
++#define Target_String(x) PyUnicode_FromString(x)
+ #define Target_Real(x) Py_None
+ #define Target_Array() PyList_New(0)
+ #define Target_SizedArray(len) PyList_New(len)
+diff -up openwsman-2.8.1/src/plugins/swig/src/target_python.c.swig45 openwsman-2.8.1/src/plugins/swig/src/target_python.c
+--- openwsman-2.8.1/src/plugins/swig/src/target_python.c.swig45	2026-07-28 10:18:09.222652899 +0200
++++ openwsman-2.8.1/src/plugins/swig/src/target_python.c	2026-07-28 10:18:09.228109133 +0200
+@@ -106,10 +106,10 @@ get_exc_trace()
+     if (obstr==NULL) 
+         TB_ERROR("getvalue() failed.");
+ 
+-    if (!PyString_Check(obstr))
++    if (!PyBytes_Check(obstr))
+         TB_ERROR("getvalue() did not return a string");
+ 
+-    debug("%s", PyString_AsString(obstr)); 
++    debug("%s", PyBytes_AsString(obstr)); 
+     args = PyTuple_New(2);
+     PyTuple_SetItem(args, 0, string2target("\n")); 
+     PyTuple_SetItem(args, 1, string2target("<br>")); 
+@@ -118,7 +118,7 @@ get_exc_trace()
+     //newstr = PyObject_CallMethod(obstr, "replace", args); 
+     newstr = PyObject_CallObject(func, args); 
+ 
+-    tbstr = PyString_AsString(newstr); 
++    tbstr = PyBytes_AsString(newstr); 
+ 
+     rv = fmtstr("plugin:%s", tbstr); 
+ 
+@@ -260,7 +260,7 @@ TargetCall(WsXmlDocH doc, PyObject* inst
+         detail = PyTuple_GetItem(result, 1); 
+     }
+ 
+-    if (! PyInt_Check(code) || (! PyInt_Check(detail) && detail != Py_None))
++    if (! PyLong_Check(code) || (! PyLong_Check(detail) && detail != Py_None))
+     {
+         TARGET_THREAD_BEGIN_ALLOW;
+         status.fault_msg = fmtstr("Python function \"%s\" didn't return a {<int>, <int>) two-tuple", opname); 
+@@ -269,7 +269,7 @@ TargetCall(WsXmlDocH doc, PyObject* inst
+         TARGET_THREAD_END_ALLOW; 
+         goto cleanup; 
+     }
+-    status.fault_code = PyInt_AsLong(code); 
++    status.fault_code = PyLong_AsLong(code); 
+     if (detail == Py_None)
+     {
+ 	status.fault_code = WSMAN_INTERNAL_ERROR;
+@@ -277,7 +277,7 @@ TargetCall(WsXmlDocH doc, PyObject* inst
+     }
+     else
+     {
+-        status.fault_detail_code = PyInt_AsLong(detail);
++        status.fault_detail_code = PyLong_AsLong(detail);
+     }
+ cleanup:
+     if (status.fault_code != WSMAN_RC_OK)
+@@ -467,8 +467,8 @@ TargetEndpoints( void *self, void *data
+       }
+       ns = PyTuple_GetItem(elem, 0);
+       prefix = PyTuple_GetItem(elem, 1);
+-      if (!PyString_Check(ns)
+-	  || !PyString_Check(prefix)) {
++      if (!PyBytes_Check(ns)
++	  || !PyBytes_Check(prefix)) {
+         TARGET_THREAD_BEGIN_ALLOW;
+         debug("Python function \"namespaces\" didn't return a list of [<string>,<string>] tuples");
+ 	status.fault_code = WSA_ENDPOINT_UNAVAILABLE;
+@@ -478,8 +478,8 @@ TargetEndpoints( void *self, void *data
+       }
+       
+       WsSupportedNamespaces *sup_ns = (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces));
+-      sup_ns->ns = PyString_AsString(ns);
+-      sup_ns->class_prefix = PyString_AsString(prefix);
++      sup_ns->ns = PyBytes_AsString(ns);
++      sup_ns->class_prefix = PyBytes_AsString(prefix);
+       node = lnode_create(ns);
+       list_append(namespaces, node);
+     }

diff --git a/openwsman.spec b/openwsman.spec
index 5a6e517..b461589 100644
--- a/openwsman.spec
+++ b/openwsman.spec
@@ -25,7 +25,7 @@
 
 Name:		openwsman
 Version:	2.8.1
-Release:	20%{?dist}
+Release:	21%{?dist}
 Summary:	Open source Implementation of WS-Management
 
 License:	BSD-3-Clause AND MIT
@@ -55,6 +55,9 @@ Patch8:		openwsman-2.7.2-ssl-certs-gen-changes.patch
 Patch9:		openwsman-2.8.1-rdoc-ruby34.patch
 Patch10:	openwsman-2.8.1-fix-ruby-io.patch
 Patch11:	openwsman-2.8.1-rdoc-6_16.patch
+# Replace removed Python 2 C API macros with Python 3 equivalents
+# for compatibility with SWIG 4.5.0
+Patch12:	openwsman-swig45.patch
 BuildRequires:	make
 BuildRequires:	swig
 BuildRequires:	libcurl-devel libxml2-devel pam-devel sblim-sfcc-devel
@@ -421,6 +424,9 @@ fi
 %endif
 
 %changelog
+* Tue Jul 28 2026 Jitka Plesnikova <jplesnik@redhat.com> - 2.8.1-21
+- Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
+
 * Fri Jul 24 2026 Python Maint <python-maint@redhat.com> - 2.8.1-20
 - Rebuilt for Python 3.15.0b4 ABI change
 

                 reply	other threads:[~2026-07-30  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178539922491.1.16326702063459635677.rpms-openwsman-4b080cc4f063@fedoraproject.org \
    --to=jplesnik@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox