[packages/unbound] add upstream fix for swig >= 4.5
atler
atler at pld-linux.org
Wed Oct 21 14:49:52 CEST 2026
commit f9b23af7241a28ca60bfdc79092ea0854edddf50
Author: Jan Palus <atler at pld-linux.org>
Date: Wed Oct 21 14:46:18 2026 +0200
add upstream fix for swig >= 4.5
swig4.5.patch | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
unbound.spec | 2 +
2 files changed, 172 insertions(+)
---
diff --git a/unbound.spec b/unbound.spec
index 184121d..d8cbfc6 100644
--- a/unbound.spec
+++ b/unbound.spec
@@ -28,6 +28,7 @@ Source4: ftp://ftp.internic.net/domain/named.cache
# Source4-md5: d838c53bc4d2afc02caefe5dee4b1b2e
Patch0: %{name}-default_trust_anchor.patch
Patch1: %{name}-sh.patch
+Patch2: swig4.5.patch
URL: http://unbound.net/
BuildRequires: autoconf >= 2.56
BuildRequires: automake
@@ -139,6 +140,7 @@ Pythonowy interfejs do biblioteki unbound.
%setup -q
%patch -P 0 -p1
%patch -P 1 -p1
+%patch -P 2 -p1
%build
%{__libtoolize}
diff --git a/swig4.5.patch b/swig4.5.patch
new file mode 100644
index 0000000..ed9bee5
--- /dev/null
+++ b/swig4.5.patch
@@ -0,0 +1,170 @@
+From 93a56205cfa6b9a6d34db7245aa71e5ca67d1fd7 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <wouter at nlnetlabs.nl>
+Date: Fri, 7 Aug 2026 08:57:32 +0200
+Subject: [PATCH] - Fix #1489 from jplesnik: Replace removed Python 2 C API
+ macros for SWIG 4.5.0 compatibility.
+
+---
+ doc/Changelog | 4 ++++
+ pythonmod/interface.i | 28 ++++++++++++++--------------
+ pythonmod/pythonmod.c | 8 ++++----
+ 3 files changed, 22 insertions(+), 18 deletions(-)
+
+diff --git a/pythonmod/interface.i b/pythonmod/interface.i
+index 735f2ed50e..7e2a188aa2 100644
+--- a/pythonmod/interface.i
++++ b/pythonmod/interface.i
+@@ -79,7 +79,7 @@
+ i+(int)((unsigned int)name[i]) < len) {
+ memmove(buf, name + i + 1, (unsigned int)name[i]);
+ buf[(unsigned int)name[i]] = 0;
+- PyList_SetItem(list, cnt, PyString_FromString(buf));
++ PyList_SetItem(list, cnt, PyUnicode_FromString(buf));
+ }
+ i += ((unsigned int)name[i]) + 1;
+ cnt++;
+@@ -96,7 +96,7 @@
+
+ list = PyList_New(len);
+ for (i=0; i < len; i++) {
+- PyList_SET_ITEM(list, i, PyString_FromString(array[i]));
++ PyList_SET_ITEM(list, i, PyUnicode_FromString(array[i]));
+ }
+ return list;
+ }
+@@ -207,7 +207,7 @@ struct query_info {
+ char buf[LDNS_MAX_DOMAINLEN];
+ buf[0] = '\0';
+ dname_str((uint8_t*)PyBytes_AsString(dname), buf);
+- return PyString_FromString(buf);
++ return PyUnicode_FromString(buf);
+ }
+ %}
+
+@@ -345,7 +345,7 @@ struct packed_rrset_data {
+ PyObject* _get_data_rr_len(struct packed_rrset_data* d, int idx) {
+ if ((d != NULL) && (idx >= 0) &&
+ ((size_t)idx < (d->count+d->rrsig_count)))
+- return PyInt_FromLong(d->rr_len[idx]);
++ return PyLong_FromLong(d->rr_len[idx]);
+ return Py_None;
+ }
+ void _set_data_rr_ttl(struct packed_rrset_data* d, int idx, uint32_t ttl)
+@@ -357,7 +357,7 @@ struct packed_rrset_data {
+ PyObject* _get_data_rr_ttl(struct packed_rrset_data* d, int idx) {
+ if ((d != NULL) && (idx >= 0) &&
+ ((size_t)idx < (d->count+d->rrsig_count)))
+- return PyInt_FromLong(d->rr_ttl[idx]);
++ return PyLong_FromLong(d->rr_ttl[idx]);
+ return Py_None;
+ }
+ PyObject* _get_data_rr_data(struct packed_rrset_data* d, int idx) {
+@@ -555,12 +555,12 @@ struct sockaddr_storage {};
+
+ if (ss->ss_family == AF_INET) {
+ const struct sockaddr_in *sa4 = (struct sockaddr_in *)ss;
+- return PyInt_FromLong(ntohs(sa4->sin_port));
++ return PyLong_FromLong(ntohs(sa4->sin_port));
+ }
+
+ if (ss->ss_family == AF_INET6) {
+ const struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)ss;
+- return PyInt_FromLong(ntohs(sa6->sin6_port));
++ return PyLong_FromLong(ntohs(sa6->sin6_port));
+ }
+
+ return Py_None;
+@@ -574,7 +574,7 @@ struct sockaddr_storage {};
+ }
+
+ sa6 = (struct sockaddr_in6 *)ss;
+- return PyInt_FromLong(ntohl(sa6->sin6_flowinfo));
++ return PyLong_FromLong(ntohl(sa6->sin6_flowinfo));
+ }
+
+ PyObject *_sockaddr_storage_scope_id(const struct sockaddr_storage *ss) {
+@@ -585,7 +585,7 @@ struct sockaddr_storage {};
+ }
+
+ sa6 = (struct sockaddr_in6 *)ss;
+- return PyInt_FromLong(ntohl(sa6->sin6_scope_id));
++ return PyLong_FromLong(ntohl(sa6->sin6_scope_id));
+ }
+ %}
+
+@@ -661,7 +661,7 @@ struct edns_option {
+ %inline %{
+ PyObject* _edns_option_opt_code_get(struct edns_option* option) {
+ uint16_t opt_code = option->opt_code;
+- return PyInt_FromLong(opt_code);
++ return PyLong_FromLong(opt_code);
+ }
+
+ PyObject* _edns_option_opt_data_get(struct edns_option* option) {
+@@ -1627,7 +1627,7 @@ int edns_opt_list_append(struct edns_option** list, uint16_t code, size_t len,
+ }
+ result = PyObject_Call(func, py_args, py_kwargs);
+ if (result) {
+- res = PyInt_AsLong(result);
++ res = PyLong_AsLong(result);
+ }
+ out:
+ Py_XDECREF(py_edns);
+@@ -1711,7 +1711,7 @@ out:
+ }
+ result = PyObject_Call(func, py_args, py_kwargs);
+ if (result) {
+- res = PyInt_AsLong(result);
++ res = PyLong_AsLong(result);
+ }
+ out:
+ Py_XDECREF(py_qinfo);
+@@ -1765,7 +1765,7 @@ out:
+ }
+ result = PyObject_Call(func, py_args, py_kwargs);
+ if (result) {
+- res = PyInt_AsLong(result);
++ res = PyLong_AsLong(result);
+ }
+ out:
+ Py_XDECREF(py_qstate);
+@@ -1814,7 +1814,7 @@ out:
+ }
+ result = PyObject_Call(func, py_args, py_kwargs);
+ if (result) {
+- res = PyInt_AsLong(result);
++ res = PyLong_AsLong(result);
+ }
+ out:
+ Py_XDECREF(py_qstate);
+diff --git a/pythonmod/pythonmod.c b/pythonmod/pythonmod.c
+index 045dd1bbd0..1aef55612d 100644
+--- a/pythonmod/pythonmod.c
++++ b/pythonmod/pythonmod.c
+@@ -246,14 +246,14 @@ log_py_err(void)
+ }
+
+ /* And it should be a string all ready to go - duplicate it. */
+- if (!PyString_Check(obResult) && !PyUnicode_Check(obResult)) {
++ if (!PyBytes_Check(obResult) && !PyUnicode_Check(obResult)) {
+ log_err("pythonmod: cannot print exception, "
+ "StringIO.getvalue() result did not String_Check"
+ " or Unicode_Check");
+ goto cleanup;
+ }
+- if(PyString_Check(obResult)) {
+- result = PyString_AsString(obResult);
++ if(PyBytes_Check(obResult)) {
++ result = PyBytes_AsString(obResult);
+ } else {
+ ascstr = PyUnicode_AsASCIIString(obResult);
+ result = PyBytes_AsString(ascstr);
+@@ -450,7 +450,7 @@ int pythonmod_init(struct module_env* env, int id)
+
+ pe->data = PyDict_New();
+ /* add the script filename to the global "mod_env" for trivial access */
+- fname = PyString_FromString(pe->fname);
++ fname = PyUnicode_FromString(pe->fname);
+ if(PyDict_SetItemString(pe->data, "script", fname) < 0) {
+ log_err("pythonmod: could not add item to dictionary");
+ Py_XDECREF(fname);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/unbound.git/commitdiff/34b23c95b118b94ac863bc0badaf1973be9cc5fa
More information about the pld-cvs-commit
mailing list