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/libbatch] rawhide: Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
Date: Tue, 28 Jul 2026 14:16:54 GMT	[thread overview]
Message-ID: <178524821435.1.8037507787135011192.rpms-libbatch-866b8091b70f@fedoraproject.org> (raw)

A new commit has been pushed.

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

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

---
diff --git a/libbatch-swig45.patch b/libbatch-swig45.patch
new file mode 100644
index 0000000..a9996ca
--- /dev/null
+++ b/libbatch-swig45.patch
@@ -0,0 +1,73 @@
+diff -up libBatch-2.4.5/src/Python/libBatch_Swig_typemap.i.swig45 libBatch-2.4.5/src/Python/libBatch_Swig_typemap.i
+--- libBatch-2.4.5/src/Python/libBatch_Swig_typemap.i.swig45	2026-07-28 09:22:20.730261630 +0200
++++ libBatch-2.4.5/src/Python/libBatch_Swig_typemap.i	2026-07-28 09:22:20.732905841 +0200
+@@ -68,8 +68,8 @@ static bool initVersatile(Batch::Versati
+     newVersatile = PyUnicode_AsUTF8(input);
+   } else if (PyBool_Check(input)) { // c'est un bool
+     newVersatile = (input == Py_True);
+-  } else if (PyInt_Check(input)) { // c'est un int
+-    newVersatile = PyInt_AsLong(input);
++  } else if (PyLong_Check(input)) { // c'est un int
++    newVersatile = PyLong_AsLong(input);
+   } else { // erreur
+     PyErr_SetString(PyExc_RuntimeWarning, "initVersatile : invalid PyObject");
+     return false;
+@@ -89,12 +89,12 @@ static PyObject * versatileToPyObj(const
+       Batch::Couple cp;
+       switch (vers.getType()) {
+       case Batch::LONG:
+-        PyList_Append(obj, PyInt_FromLong(* static_cast<Batch::LongType *>(*it)));
++        PyList_Append(obj, PyLong_FromLong(* static_cast<Batch::LongType *>(*it)));
+         break;
+ 
+       case Batch::STRING:
+         st = * static_cast<Batch::StringType *>(*it);
+-        PyList_Append(obj, PyString_FromString(st.c_str()));
++        PyList_Append(obj, PyUnicode_FromString(st.c_str()));
+         break;
+ 
+       case Batch::COUPLE:
+@@ -119,12 +119,12 @@ static PyObject * versatileToPyObj(const
+       break;
+ 
+     case Batch::LONG:
+-      obj = PyInt_FromLong(* static_cast<Batch::LongType *>(vers.front()));
++      obj = PyLong_FromLong(* static_cast<Batch::LongType *>(vers.front()));
+       break;
+ 
+     case Batch::STRING:
+       st = * static_cast<Batch::StringType *>(vers.front());
+-      obj = PyString_FromString(st.c_str());
++      obj = PyUnicode_FromString(st.c_str());
+       break;
+ 
+     case Batch::COUPLE:
+@@ -201,7 +201,7 @@ static bool initEnvironment(Batch::Envir
+   for(std::map<std::string, Batch::FactBatchManager *>::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) {
+     std::string key = (*it).first;
+     PyObject * obj  = SWIG_NewPointerObj((void *) (*it).second, SWIGTYPE_p_Batch__FactBatchManager, 0);
+-    PyDict_SetItem($result, PyString_FromString(key.c_str()), obj);
++    PyDict_SetItem($result, PyUnicode_FromString(key.c_str()), obj);
+   }
+ }
+ 
+@@ -220,7 +220,7 @@ static bool initEnvironment(Batch::Envir
+   for(Batch::Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) {
+     const std::string & key = (*it).first;
+     const Batch::Versatile & vers = (*it).second;
+-    PyDict_SetItem($result, PyString_FromString(key.c_str()), versatileToPyObj(vers));
++    PyDict_SetItem($result, PyUnicode_FromString(key.c_str()), versatileToPyObj(vers));
+   }
+ }
+ 
+@@ -255,8 +255,8 @@ static bool initEnvironment(Batch::Envir
+     std::string key = (*it).first;
+     std::string val = (*it).second;
+     PyDict_SetItem($result, 
+-		   PyString_FromString(key.c_str()),
+-		   PyString_FromString(val.c_str()));
++		   PyUnicode_FromString(key.c_str()),
++		   PyUnicode_FromString(val.c_str()));
+   }
+ }
+ 

diff --git a/libbatch.spec b/libbatch.spec
index 4440dd9..5b81e2b 100644
--- a/libbatch.spec
+++ b/libbatch.spec
@@ -1,6 +1,6 @@
 Name:           libbatch
 Version:        2.4.5
-Release:        24%{?dist}
+Release:        25%{?dist}
 Summary:        Generic batch management library
 
 # Automatically converted from old format: LGPLv2 - review is highly recommended.
@@ -11,6 +11,9 @@ Source0:        http://files.salome-platform.org/Salome/other/libBatch-%{version
 Patch0:         libbatch_libdir.patch
 # Set a library soversion
 Patch1:         libbatch_soversion.patch
+# Replace removed Python 2 C API macros with Python 3 equivalents
+# for compatibility with SWIG 4.5.0
+Patch2:         libbatch-swig45.patch
 
 BuildRequires:  cmake
 BuildRequires:  gcc-c++
@@ -70,6 +73,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}
 
 
 %changelog
+* Tue Jul 28 2026 Jitka Plesnikova <jplesnik@redhat.com> - 2.4.5-25
+- Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
+
 * Wed Jul 22 2026 Python Maint <python-maint@redhat.com> - 2.4.5-24
 - Rebuilt for Python 3.15.0b4 ABI change
 

                 reply	other threads:[~2026-07-28 14:16 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=178524821435.1.8037507787135011192.rpms-libbatch-866b8091b70f@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