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/gensio] rawhide: Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
Date: Wed, 29 Jul 2026 23:25:50 GMT	[thread overview]
Message-ID: <178536755051.1.13927199000567782623.rpms-gensio-8cfd58231a8d@fedoraproject.org> (raw)

A new commit has been pushed.

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

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

---
diff --git a/gensio-swig45.patch b/gensio-swig45.patch
new file mode 100644
index 0000000..e22dda5
--- /dev/null
+++ b/gensio-swig45.patch
@@ -0,0 +1,174 @@
+diff -up gensio-3.0.3/c++/swig/pygensio/pygensio.i.swig45 gensio-3.0.3/c++/swig/pygensio/pygensio.i
+--- gensio-3.0.3/c++/swig/pygensio/pygensio.i.swig45	2026-07-28 07:53:35.537381625 +0200
++++ gensio-3.0.3/c++/swig/pygensio/pygensio.i	2026-07-28 07:53:35.545381780 +0200
+@@ -132,7 +132,7 @@ PI_StringArrayToTuple(const char *const
+ 	    ;
+ 	o = PyTuple_New(len);
+ 	for (i = 0; i < len; i++)
+-	    PyTuple_SetItem(o, i, PyString_FromString(val[i]));
++	    PyTuple_SetItem(o, i, PyUnicode_FromString(val[i]));
+ 	return o;
+     }
+ }
+@@ -380,7 +380,7 @@ static bool check_for_err(int err)
+     $1 = &temp;
+ }
+ %typemap(argout) unsigned int *outval {
+-    $result = PI_add_result($result, PyInt_FromLong(*$1));
++    $result = PI_add_result($result, PyLong_FromLong(*$1));
+ }
+ 
+ // Handling of nested waiters and python callback.
+diff -up gensio-3.0.3/swig/python/gensio_langinfo.i.swig45 gensio-3.0.3/swig/python/gensio_langinfo.i
+--- gensio-3.0.3/swig/python/gensio_langinfo.i.swig45	2026-07-28 07:53:35.538381644 +0200
++++ gensio-3.0.3/swig/python/gensio_langinfo.i	2026-07-28 07:53:35.546796179 +0200
+@@ -60,7 +60,7 @@
+ }
+ 
+ %typemap(argout) (long *r_int) {
+-    PyObject *r = PyInt_FromLong(*$1);
++    PyObject *r = PyLong_FromLong(*$1);
+ 
+     $result = add_python_result($result, r);
+ }
+diff -up gensio-3.0.3/swig/python/gensio_python.h.swig45 gensio-3.0.3/swig/python/gensio_python.h
+--- gensio-3.0.3/swig/python/gensio_python.h.swig45	2026-07-28 07:53:35.540381683 +0200
++++ gensio-3.0.3/swig/python/gensio_python.h	2026-07-28 07:53:35.548381838 +0200
+@@ -67,9 +67,9 @@ OI_PI_AsBytesAndSize(PyObject *o, char *
+ #define OI_PI_StringCheck PyUnicode_Check
+ #define OI_PI_FromStringAndSize PyUnicode_FromStringAndSize
+ #else
+-#define OI_PI_BytesCheck PyString_Check
++#define OI_PI_BytesCheck PyBytes_Check
+ #define OI_PI_AsBytesAndSize PyString_AsStringAndSize
+-#define OI_PI_StringCheck PyString_Check
++#define OI_PI_StringCheck PyBytes_Check
+ #define OI_PI_FromStringAndSize PyString_FromStringAndSize
+ #endif
+ 
+@@ -365,7 +365,7 @@ gensio_control_cb(struct gensio *io, int
+     args = PyTuple_New(3);
+     gensio_pyref(io);
+     PyTuple_SET_ITEM(args, 0, io_ref.val);
+-    o = PyInt_FromLong(err);
++    o = PyLong_FromLong(err);
+     PyTuple_SET_ITEM(args, 1, o);
+     o = PyBytes_FromStringAndSize(buf, len);
+     PyTuple_SET_ITEM(args, 2, o);
+@@ -393,7 +393,7 @@ sgensio_call(struct gensio *io, long val
+     args = PyTuple_New(2);
+     ref_gensio_data(data);
+     PyTuple_SET_ITEM(args, 0, io_ref.val);
+-    o = PyInt_FromLong(val);
++    o = PyLong_FromLong(val);
+     PyTuple_SET_ITEM(args, 1, o);
+ 
+     swig_finish_call(data->handler_val, func, args, true);
+@@ -578,7 +578,7 @@ gensio_py_handle_auxdata(const char *con
+ 	    len++;
+ 	o = PyTuple_New(len);
+ 	for (i = 0; i < len; i++)
+-	    PyTuple_SetItem(o, i, PyString_FromString(auxdata[i]));
++	    PyTuple_SetItem(o, i, PyUnicode_FromString(auxdata[i]));
+ 	return o;
+     }
+ }
+@@ -706,7 +706,7 @@ gensio_child_event(struct gensio *io, vo
+ 	args = PyTuple_New(3);
+ 	ref_gensio_data(data);
+ 	PyTuple_SET_ITEM(args, 0, io_ref.val);
+-	o = PyInt_FromLong(readerr);
++	o = PyLong_FromLong(readerr);
+ 	PyTuple_SET_ITEM(args, 1, o);
+ 	if (auxdata && auxdata[0]) {
+ 	    o = OI_PI_FromString(auxdata[0]);
+@@ -753,8 +753,8 @@ gensio_child_event(struct gensio *io, vo
+ 		    *buflen = len;
+ 		memcpy(buf, p, *buflen);
+ 		rv = 0;
+-	    } else if (PyInt_Check(o)) {
+-		rv = PyInt_AsLong(o);
++	    } else if (PyLong_Check(o)) {
++		rv = PyLong_AsLong(o);
+ 	    }
+ 	    Py_DecRef(o);
+ 	}
+@@ -802,8 +802,8 @@ gensio_child_event(struct gensio *io, vo
+ 			*buflen = len;
+ 		    }
+ 		}
+-	    } else if (PyInt_Check(o)) {
+-		rv = PyInt_AsLong(o);
++	    } else if (PyLong_Check(o)) {
++		rv = PyLong_AsLong(o);
+ 	    }
+ 	    Py_DecRef(o);
+ 	}
+@@ -842,9 +842,9 @@ gensio_child_event(struct gensio *io, vo
+ 	args = PyTuple_New(3);
+ 	ref_gensio_data(data);
+ 	PyTuple_SET_ITEM(args, 0, io_ref.val);
+-	o = PyInt_FromLong(height);
++	o = PyLong_FromLong(height);
+ 	PyTuple_SET_ITEM(args, 1, o);
+-	o = PyInt_FromLong(width);
++	o = PyLong_FromLong(width);
+ 	PyTuple_SET_ITEM(args, 2, o);
+ 	swig_finish_call(data->handler_val, "win_size", args, true);
+ 	break;
+@@ -1041,7 +1041,7 @@ gensio_acc_io_call_cb(struct gensio_acce
+     PyTuple_SET_ITEM(args, 0, acc_ref.val);
+     PyTuple_SET_ITEM(args, 1, io_ref.val);
+     if (opterr >= 0) {
+-	o = PyInt_FromLong(opterr);
++	o = PyLong_FromLong(opterr);
+ 	PyTuple_SET_ITEM(args, 2, o);
+ 	if (optstr) {
+ 	    o = OI_PI_FromString(optstr);
+@@ -1177,8 +1177,8 @@ gensio_acc_child_event(struct gensio_acc
+ 		    pwvfy->password_len = len;
+ 		memcpy(pwvfy->password, p, pwvfy->password_len);
+ 		rv = 0;
+-	    } else if (PyInt_Check(o)) {
+-		rv = PyInt_AsLong(o);
++	    } else if (PyLong_Check(o)) {
++		rv = PyLong_AsLong(o);
+ 	    }
+ 	    Py_DecRef(o);
+ 	}
+@@ -1234,8 +1234,8 @@ gensio_acc_child_event(struct gensio_acc
+ 			pwvfy->password_len = len;
+ 		    }
+ 		}
+-	    } else if (PyInt_Check(o)) {
+-		rv = PyInt_AsLong(o);
++	    } else if (PyLong_Check(o)) {
++		rv = PyLong_AsLong(o);
+ 	    }
+ 	    Py_DecRef(o);
+ 	}
+@@ -1374,8 +1374,8 @@ static void gensio_mdns_cb(struct gensio
+ 
+     args = PyTuple_New(9);
+     PyTuple_SET_ITEM(args, 0, PyBool_FromLong(state == GENSIO_MDNS_WATCH_NEW_DATA));
+-    PyTuple_SET_ITEM(args, 1, PyInt_FromLong(ipinterface));
+-    PyTuple_SET_ITEM(args, 2, PyInt_FromLong(ipdomain));
++    PyTuple_SET_ITEM(args, 1, PyLong_FromLong(ipinterface));
++    PyTuple_SET_ITEM(args, 2, PyLong_FromLong(ipdomain));
+     PyTuple_SET_ITEM(args, 3, OI_PI_FromStringN(name));
+     PyTuple_SET_ITEM(args, 4, OI_PI_FromStringN(type));
+     PyTuple_SET_ITEM(args, 5, OI_PI_FromStringN(domain));
+diff -up gensio-3.0.3/swig/python/python_swig_internals.h.swig45 gensio-3.0.3/swig/python/python_swig_internals.h
+--- gensio-3.0.3/swig/python/python_swig_internals.h.swig45	2026-07-28 07:53:35.541381702 +0200
++++ gensio-3.0.3/swig/python/python_swig_internals.h	2026-07-28 07:53:35.549137358 +0200
+@@ -52,8 +52,8 @@ swig_cb_val *gensio_python_deref_swig_cb
+ #define OI_PI_FromString PyUnicode_FromString
+ #define OI_PI_AsString PyUnicode_AsUTF8
+ #else
+-#define OI_PI_FromString PyString_FromString
+-#define OI_PI_AsString PyString_AsString
++#define OI_PI_FromString PyUnicode_FromString
++#define OI_PI_AsString PyBytes_AsString
+ #endif
+ 
+ GENSIO_DLL_PUBLIC

diff --git a/gensio.spec b/gensio.spec
index dcc4b88..5f594c8 100644
--- a/gensio.spec
+++ b/gensio.spec
@@ -14,6 +14,10 @@ License:        GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
 URL:            %{forgeurl}
 Source0:        %{forgesource}
 
+# Replace removed Python 2 C API macros with Python 3 equivalents
+# for compatibility with SWIG 4.5.0
+Patch0:         gensio-swig45.patch
+
 BuildRequires:  alsa-lib-devel
 BuildRequires:  avahi-devel
 BuildRequires:  gcc-c++

                 reply	other threads:[~2026-07-29 23:25 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=178536755051.1.13927199000567782623.rpms-gensio-8cfd58231a8d@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