#1145860 unbound: FTBFS: ./pythonmod/interface.h:3372:43: error: implicit declaration of function 'PyString_FromString'; did you mean 'PyLong_FromString'? [-Wimplicit-function-declaration]

Package:
src:unbound
Source:
src:unbound
Submitter:
Santiago Vila
Date:
2026-08-31 04:51:02 UTC
Severity:
normal
Tags:
#1145860#5
Date:
2026-08-27 11:53:38 UTC
From:
To:
Dear maintainer:

During a rebuild of all packages in unstable, this package failed to build.

Below you will find the last part of the build log (probably the most
relevant part, but not necessarily). If required, the full build log
is available here:

https://people.debian.org/~sanvila/build-logs/202608/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you cannot reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and add an affects on src:unbound, so that this is still
visible in the BTS web page for this package.

Thanks.
--------------------------------------------------------------------------------
[...]
cp smallapp/unbound-control-setup.sh unbound-control-setup
chmod +x unbound-control-setup
/usr/bin/swig -python -o libunbound/python/libunbound_wrap.c -I. -I../.. -I/usr/include/python3.14 -DPY_MAJOR_VERSION=3 ../../libunbound/python/libunbound.i
touch util/configparser.h
./libtool --tag=CC --mode=compile x86_64-linux-gnu-gcc -I. -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I/usr/include/python3.14 -DSRCDIR=../.. -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffile-prefix-map=../../= -pthread  -o pythonmod.lo -c ../../pythonmod/pythonmod.c
libtool: compile:  x86_64-linux-gnu-gcc -I. -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I/usr/include/python3.14 -DSRCDIR=../.. -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffile-prefix-map=../../= -pthread -c ../../pythonmod/pythonmod.c  -fPIC -DPIC -o .libs/pythonmod.o
In file included from ../../pythonmod/pythonmod.c:145:
./pythonmod/interface.h: In function 'GetNameAsLabelList':
./pythonmod/interface.h:3372:43: error: implicit declaration of function 'PyString_FromString'; did you mean 'PyLong_FromString'? [-Wimplicit-function-declaration]
 3372 |                 PyList_SetItem(list, cnt, PyString_FromString(buf));
      |                                           ^~~~~~~~~~~~~~~~~~~
      |                                           PyLong_FromString
./pythonmod/interface.h:3372:43: error: passing argument 3 of 'PyList_SetItem' makes pointer from integer without a cast [-Wint-conversion]
 3372 |                 PyList_SetItem(list, cnt, PyString_FromString(buf));
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                           |
      |                                           int
In file included from /usr/include/python3.14/Python.h:92,
                 from ../../pythonmod/pythonmod.c:54:
/usr/include/python3.14/listobject.h:35:56: note: expected 'PyObject *' {aka 'struct _object *'} but argument is of type 'int'
   35 | PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
      |                                                        ^~~~~~~~~~
In file included from /usr/include/python3.14/Python.h:64:
./pythonmod/interface.h: In function 'CharArrayAsStringList':
/usr/include/python3.14/pyport.h:37:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   37 | #define _Py_CAST(type, expr) ((type)(expr))
      |                               ^
/usr/include/python3.14/object.h:174:28: note: in expansion of macro '_Py_CAST'
  174 | #define _PyObject_CAST(op) _Py_CAST(PyObject*, (op))
      |                            ^~~~~~~~
/usr/include/python3.14/cpython/listobject.h:50:50: note: in expansion of macro '_PyObject_CAST'
   50 |     PyList_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))
      |                                                  ^~~~~~~~~~~~~~
./pythonmod/interface.h:3389:13: note: in expansion of macro 'PyList_SET_ITEM'
 3389 |             PyList_SET_ITEM(list, i, PyString_FromString(array[i]));
      |             ^~~~~~~~~~~~~~~
./pythonmod/interface.h: In function 'dnameAsStr':
./pythonmod/interface.h:3740:15: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 3740 |        return PyString_FromString(buf);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function '_get_data_rr_len':
./pythonmod/interface.h:3980:16: error: implicit declaration of function 'PyInt_FromLong'; did you mean 'PyLong_FromLong'? [-Wimplicit-function-declaration]
 3980 |         return PyInt_FromLong(d->rr_len[idx]);
      |                ^~~~~~~~~~~~~~
      |                PyLong_FromLong
./pythonmod/interface.h:3980:16: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 3980 |         return PyInt_FromLong(d->rr_len[idx]);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function '_get_data_rr_ttl':
./pythonmod/interface.h:3992:16: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 3992 |         return PyInt_FromLong(d->rr_ttl[idx]);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function '_sockaddr_storage_port':
./pythonmod/interface.h:4114:20: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 4114 |             return PyInt_FromLong(ntohs(sa4->sin_port));
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h:4119:20: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 4119 |             return PyInt_FromLong(ntohs(sa6->sin6_port));
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function '_sockaddr_storage_flowinfo':
./pythonmod/interface.h:4133:16: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 4133 |         return PyInt_FromLong(ntohl(sa6->sin6_flowinfo));
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function '_sockaddr_storage_scope_id':
./pythonmod/interface.h:4144:16: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 4144 |         return PyInt_FromLong(ntohl(sa6->sin6_scope_id));
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function '_edns_option_opt_code_get':
./pythonmod/interface.h:4150:16: error: returning 'int' from a function with return type 'PyObject *' {aka 'struct _object *'} makes pointer from integer without a cast [-Wint-conversion]
 4150 |         return PyInt_FromLong(opt_code);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
./pythonmod/interface.h: In function 'python_inplace_cb_reply_generic':
./pythonmod/interface.h:4557:19: error: implicit declaration of function 'PyInt_AsLong'; did you mean 'PyLong_AsLong'? [-Wimplicit-function-declaration]
 4557 |             res = PyInt_AsLong(result);
      |                   ^~~~~~~~~~~~
      |                   PyLong_AsLong
../../pythonmod/pythonmod.c: In function 'log_py_err':
../../pythonmod/pythonmod.c:249:14: error: implicit declaration of function 'PyString_Check'; did you mean 'PyMapping_Check'? [-Wimplicit-function-declaration]
  249 |         if (!PyString_Check(obResult) && !PyUnicode_Check(obResult)) {
      |              ^~~~~~~~~~~~~~
      |              PyMapping_Check
../../pythonmod/pythonmod.c:256:26: error: implicit declaration of function 'PyString_AsString' [-Wimplicit-function-declaration]
  256 |                 result = PyString_AsString(obResult);
      |                          ^~~~~~~~~~~~~~~~~
../../pythonmod/pythonmod.c:256:24: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  256 |                 result = PyString_AsString(obResult);
      |                        ^
../../pythonmod/pythonmod.c: In function 'pythonmod_init':
../../pythonmod/pythonmod.c:453:10: error: assignment to 'PyObject *' {aka 'struct _object *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
  453 |    fname = PyString_FromString(pe->fname);
      |          ^
touch dnstap/dnstap.pb-c.h
./libtool --tag=CC --mode=compile x86_64-linux-gnu-gcc -I. -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I/usr/include/python3.14 -DSRCDIR=../.. -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffile-prefix-map=../../= -pthread  -o libunbound_wrap.lo -c libunbound/python/libunbound_wrap.c
make[4]: *** [Makefile:322: pythonmod.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
libtool: compile:  x86_64-linux-gnu-gcc -I. -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I/usr/include/python3.14 -DSRCDIR=../.. -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffile-prefix-map=../../= -pthread -c libunbound/python/libunbound_wrap.c  -fPIC -DPIC -o .libs/libunbound_wrap.o
libtool: compile:  x86_64-linux-gnu-gcc -I. -Wdate-time -D_FORTIFY_SOURCE=2 -I../.. -I/usr/include/python3.14 -DSRCDIR=../.. -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffile-prefix-map=../../= -pthread -c libunbound/python/libunbound_wrap.c -o libunbound_wrap.o >/dev/null 2>&1
make[4]: Leaving directory '/<<PKGBUILDDIR>>/b/unbound'
make[3]: *** [debian/rules:75: b/unbound/build-stamp] Error 2
make[3]: Leaving directory '/<<PKGBUILDDIR>>'
make[2]: *** [debian/rules:55: build] Error 2
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
make[1]: *** [debian/rules:55: install] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:55: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
--------------------------------------------------------------------------------

#1145860#10
Date:
2026-08-30 19:49:02 UTC
From:
To:
This issue is caused by the removal of the Python 2 compatibility macros in version 4.5.0 of SWIG. [1] According to the SWIG authors, these macros were retained in the generated code (pyhead.swg) solely for user typemaps. All typemap using these macros are updated to call the Python 3 C API directly.

I submitted a patch for fixing the issue as a merge request at Salsa [2]. It was taken from the upstream Git repository (commit 93a56205 [3]).

Best,

Rafael Laboissière

[1] https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d
[2] https://salsa.debian.org/dns-team/unbound/-/merge_requests/27
[3] https://github.com/NLnetLabs/unbound/commit/93a56205cfa6b9a6d34db7245aa71e5ca67d1fd7

#1145860#17
Date:
2026-08-31 04:49:10 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
unbound, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1145860@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Tokarev <mjt@tls.msk.ru> (supplier of updated unbound package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 31 Aug 2026 07:18:21 +0300
Source: unbound
Architecture: source
Version: 1.26.0-2
Distribution: unstable
Urgency: medium
Maintainer: unbound packagers <unbound@packages.debian.org>
Changed-By: Michael Tokarev <mjt@tls.msk.ru>
Closes: 1145860
Changes:
 unbound (1.26.0-2) unstable; urgency=medium
 .
   * replace-removed-Python-2-C-API-macros.patch from upstream
     (Closes: #1145860)
Checksums-Sha1:
 fb66b9e59a5343d04d2781e381e0162189d1df3d 3221 unbound_1.26.0-2.dsc
 eebb515fb55b06181389ab7c8116e8baec0288bf 31232 unbound_1.26.0-2.debian.tar.xz
 b08bda7e28fa0b47b3a7ef88516979234675eb2a 5781 unbound_1.26.0-2_source.buildinfo
Checksums-Sha256:
 47c820663e0417778b8fb5dd538496515067e349fa51db8ace8494ffea329177 3221 unbound_1.26.0-2.dsc
 f0589cd8cd5e9481dd161c8cebc6f35d15a46484aef9b9b1d70c5ee96e395268 31232 unbound_1.26.0-2.debian.tar.xz
 58f19923d492366769057a5345e4a49040c3f1f5df32e59927cad0b0ec34c737 5781 unbound_1.26.0-2_source.buildinfo
Files:
 b708fa2e8cb692b535d8476124709f0d 3221 net optional unbound_1.26.0-2.dsc
 5c1ea3db24f01cb937262c918dea6491 31232 net optional unbound_1.26.0-2.debian.tar.xz
 6e73f7617135eaa81a8e97480f54ea52 5781 net optional unbound_1.26.0-2_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmqVAMsACgkQgqpKJDse
lHiy/w/9FI8huMjxJoWjy06l82x112bsJRsXHVLk8G51W610zekXDk3IRjKtjGpN
13G+qaA9vEFjDbB5qu2tGwfIK/DrhmZhXDMiVQjQFssEI2/mmRAEaSZGiBTCiZvg
z6t8qIYEiBSgMmrRiY/fEvFvTQhCpJKY6taJXsuolGSgECcbHyrigj4sgJFDRBYo
NRpGOk/mw6kcGVgTBfI8GoDY9h8I9L8fWuvYORE+n24byAEQzhTxP20RCkn1sf3k
C0f9VOXQitRp+yVhM1h7HUCaVKg1ckPt6KgWMUMPSHGjrU3gWMU4QFIzM9iNPWsU
/iO2Zky/V/cWACVrcyk3GYaO38F6oixgcTtvaWBQjZZH34zzkaGrCm/BvYzSP66A
m2HBffQ+MOJIUh8J6bGpL32kLw2thnNyERXstrE8zC8Cyk9ivWaUkEeVS9iz9PSz
RL9n7AI5Vj9Wjs7aMNGcB2syPFLyPNcZcR2HRZl0+7nm/R8jXPfvaE2TmhjW6zxL
gopzQCsaSkGh3z+B59rcUYeaAGGVwsVnbh3Kj2h3xMIQZAC3MeYkHcOUhbeC58sw
TQv/NmtFVXLwzCgnZtWESSr2/nRoQq0nwnGkBXwpWOtaa/wkE0bwr5Nmhb62LOwx
bTQEKor99NElOzGoyxbrVK+y6YkLsy60zaoV38mDucQSDaawSqA=
=Z8WK
-----END PGP SIGNATURE-----