#1146035 python-fann2: FTBFS: fann2/fann2_wrap.cpp:10062:41: error: 'PyInt_AsLong' was not declared in this scope; did you mean 'PyLong_AsLong'?

Package:
src:python-fann2
Source:
src:python-fann2
Submitter:
Santiago Vila
Date:
2026-09-10 10:51:16 UTC
Severity:
normal
Tags:
#1146035#5
Date:
2026-08-29 10:32:35 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:python-fann2, so that this is still
visible in the BTS web page for this package.

Thanks.
--------------------------------------------------------------------------------
[...]
swig -python -c++ -o fann2/fann2_wrap.cpp fann2/fann2.i
creating build/temp.linux-x86_64-cpython-314/fann2
x86_64-linux-gnu-g++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSWIG_COMPILE -I./include -I../include -Iinclude -I/usr/include/python3.14 -c fann2/fann2_wrap.cpp -o build/temp.linux-x86_64-cpython-314/fann2/fann2_wrap.o
fann2/fann2_wrap.cpp: In function ‘PyObject* _wrap_neural_net_create_standard_array(PyObject*, PyObject*)’:
fann2/fann2_wrap.cpp:10062:41: error: ‘PyInt_AsLong’ was not declared in this scope; did you mean ‘PyLong_AsLong’?
10062 |         arg2->array[i] = (unsigned int) PyInt_AsLong(o);
      |                                         ^~~~~~~~~~~~
      |                                         PyLong_AsLong
fann2/fann2_wrap.cpp: In function ‘PyObject* _wrap_neural_net_create_sparse_array(PyObject*, PyObject*)’:
fann2/fann2_wrap.cpp:10135:41: error: ‘PyInt_AsLong’ was not declared in this scope; did you mean ‘PyLong_AsLong’?
10135 |         arg3->array[i] = (unsigned int) PyInt_AsLong(o);
      |                                         ^~~~~~~~~~~~
      |                                         PyLong_AsLong
fann2/fann2_wrap.cpp: In function ‘PyObject* _wrap_neural_net_create_shortcut_array(PyObject*, PyObject*)’:
fann2/fann2_wrap.cpp:10200:41: error: ‘PyInt_AsLong’ was not declared in this scope; did you mean ‘PyLong_AsLong’?
10200 |         arg2->array[i] = (unsigned int) PyInt_AsLong(o);
      |                                         ^~~~~~~~~~~~
      |                                         PyLong_AsLong
fann2/fann2_wrap.cpp: In function ‘PyObject* _wrap_neural_net_get_layer_array(PyObject*, PyObject*)’:
fann2/fann2_wrap.cpp:10557:21: error: ‘PyInt_FromLong’ was not declared in this scope; did you mean ‘PyLong_FromLong’?
10557 |       PyObject *o = PyInt_FromLong( (long) result->array[i]);
      |                     ^~~~~~~~~~~~~~
      |                     PyLong_FromLong
fann2/fann2_wrap.cpp: In function ‘PyObject* _wrap_neural_net_get_bias_array(PyObject*, PyObject*)’:
fann2/fann2_wrap.cpp:10594:21: error: ‘PyInt_FromLong’ was not declared in this scope; did you mean ‘PyLong_FromLong’?
10594 |       PyObject *o = PyInt_FromLong( (long) result->array[i]);
      |                     ^~~~~~~~~~~~~~
      |                     PyLong_FromLong
fann2/fann2_wrap.cpp: In function ‘PyObject* _wrap_neural_net_set_weight_array(PyObject*, PyObject*)’:
fann2/fann2_wrap.cpp:10672:11: error: ‘PyInt_Check’ was not declared in this scope; did you mean ‘PySet_Check’?
10672 |       if (PyInt_Check(from_neuron) && PyInt_Check(to_neuron) &&
      |           ^~~~~~~~~~~
      |           PySet_Check
fann2/fann2_wrap.cpp:10674:53: error: ‘PyInt_AsLong’ was not declared in this scope; did you mean ‘PyLong_AsLong’?
10674 |         arg2->array[i].from_neuron = (unsigned int) PyInt_AsLong(from_neuron);
      |                                                     ^~~~~~~~~~~~
      |                                                     PyLong_AsLong
error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1
E: pybuild pybuild:485: build: plugin distutils failed with: exit code=1: /usr/bin/python3 setup.py build
dh_auto_build: error: pybuild --build -i python{version} -p 3.14 --parallel=2 returned exit code 13
make: *** [debian/rules:13: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
--------------------------------------------------------------------------------

#1146035#10
Date:
2026-08-30 16:35:37 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]

Best,

Rafael Laboissière

[1] https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d
[2] https://salsa.debian.org/science-team/python-fann2/-/merge_requests/3

#1146035#17
Date:
2026-09-10 10:49:09 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
python-fann2, 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 1146035@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael R. Crusoe <crusoe@debian.org> (supplier of updated python-fann2 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: Thu, 10 Sep 2026 12:33:34 +0200
Source: python-fann2
Architecture: source
Version: 1:1.2.0+ds-6
Distribution: unstable
Urgency: medium
Maintainer: Debian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
Changed-By: Michael R. Crusoe <crusoe@debian.org>
Closes: 1146035
Changes:
 python-fann2 (1:1.2.0+ds-6) unstable; urgency=medium
 .
   * Team upload.
   * Accept patch from Rafael Laboissière to fix the FTBFS with swig
     4.5.0. Closes: #1146035.
   * Standards-Version: 4.7.4 (routine-update)
   * Reorder sequence of d/control VCS fields (cme)
   * Reflow Uploaders field (cme)
   * Remove Priority field (cme)
Checksums-Sha1:
 82aacc93f1c039c93957f30d8e0fa1a60c583335 2133 python-fann2_1.2.0+ds-6.dsc
 639acda8e581442e0b2424e325ad2caa781b5a7e 6540 python-fann2_1.2.0+ds-6.debian.tar.xz
 39e7b4bccfde59c84280b921391365c04c70375e 10378 python-fann2_1.2.0+ds-6_source.buildinfo
Checksums-Sha256:
 1c5b7ca47c6ae854f7c3c52959d72b3915174656bf39a13db1bcc2dee2e5cd45 2133 python-fann2_1.2.0+ds-6.dsc
 2fde5b2900667d610c3ee12327aeef95a0eed0464b205ba6e6cc0e34c019b806 6540 python-fann2_1.2.0+ds-6.debian.tar.xz
 085dffdf6c1fd5f9d334bdc7f1c16c71e504c78e839e43ab41d2ec7f64155422 10378 python-fann2_1.2.0+ds-6_source.buildinfo
Files:
 4afdfd50ff11283603c0bd08c7ab72ba 2133 python optional python-fann2_1.2.0+ds-6.dsc
 cfb6e074ec5966f450cb8b31b8d7aebf 6540 python optional python-fann2_1.2.0+ds-6.debian.tar.xz
 cbe13d7e30955eee2c30fe793a0100aa 10378 python optional python-fann2_1.2.0+ds-6_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJGBAEBCgAwFiEEck1gkzcRPHEFUNdHPCZ2P2xn5uIFAmqiiAMSHGNydXNvZUBk
ZWJpYW4ub3JnAAoJEDwmdj9sZ+biGKIQAJ9/fWRu9nZ8w2MoH5RJvkpvKAqddUf1
fCG1iCg8a4/xZ078k2hwxWlFULarURuQiYn33T23FtA9jtf+aPYC7Z44k3GiGliu
f1KDotXq8j+ugNhLpBZcW3Cy1acfi1XcIc7QUiDRzHMYGNP01K5SnYd+349UIL5z
cECnvML4JMFvXSGURrU9GWyYRoRv4GW60AmWiPgGm0MCE6xG65yHRkF73PqnZM7L
92cTGCGHHLGmyWaDq7M63PzLh8J9qOvaNyzFSD8gO01pftoKH77owRcPRx2sX2CH
FYCY65BBr7SaR5EBlQ5ejs3WpDS/79zOg9rRGi4uI3/g5iy6HrD8v3SJeH5aOKn4
wz0yhqfkT0DA/U6vMU0mZ9dbDGVvg7kisvyrJ77q6FuNvoxxpNgM1EtQu1UPKSqg
0pJfccPlWAW6Yw+P5KC0NVoDs3RJ+ExT6jILZ0uF3JJ/3pbGih/dpO0Fs6PwM6D9
YwxruDegsdbDSKVTPUmPXZ3uHVnjAtFxEpEmA/Rbas5cGYTbU31bPkyXM0qW1WXM
ihaZIAZG0nGFCVUSyCEUm5i/K5MsQd1yhFWehqtx64RxxDcKja5IfzLwWxJO9eBW
r7/mVVCZAmvOtlnSQwyvdm4ocWfnV4pK9e9Myys3LNhmOKDrlxUa9H8pLAzoD8e5
4+HDgcK31cVC
=XnFc
-----END PGP SIGNATURE-----