Please, disregard the file attached to my previous message. It is not intended 
for the armnn package. (Oh, the joy of doing mass bug reports! …)

Rafael Laboissière

* Rafael Laboissière <[email protected]> [2026-08-31 12:56]:

> Control: tags -1 + patch upstream fixed-upstream
>
> Hi,
>
> The current issue is due to 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 to fix the problem as a merge request on Salsa [2]. 
> Unfortunately, once the changes for the NMU'ed version 23.08-5.1 have been 
> integrated into the repository, this commit will not merge cleanly into the 
> dgit/sid default branch.
>
> Please note that PyArmNN support was dropped upstream (commit dd630033 [3]), 
> as of December 13, 2024. This change is included in version 25.02 [4], so 
> upgrading the package to the latest released upstream version (26.07) should 
> also fix the issue.
>
> Best,
>
> Rafael
>
> [1] 
> https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d
> [2] https://salsa.debian.org/deeplearning-team/armnn/-/merge_requests/3
> [3] 
> https://github.com/ARM-software/armnn/commit/dd63003310dcb0b9d7af606a0f2161eeabf6308a
> [4] https://github.com/ARM-software/armnn/releases/tag/v25.02

> Description: Build with swig 4.5.0
>  Without this patch, the package FTBFS with swig 4.5.0. This is due to
>  the removal of the Python 2 compatibility macros in version 4.5.0. [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.
>  .
>  [1] 
> https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d
> Author: Rafael Laboissière <[email protected]>
> Bug-Debian: https:/bugs.debian.org/1145848
> Forwarded: not-needed
> Last-Update: 2026-08-30
>
> --- nlopt-2.7.1.orig/src/swig/numpy.i
> +++ nlopt-2.7.1/src/swig/numpy.i
> @@ -77,8 +77,8 @@
>      if (py_obj == NULL          ) return "C NULL value";
>      if (py_obj == Py_None       ) return "Python None" ;
>      if (PyCallable_Check(py_obj)) return "callable"    ;
> -    if (PyString_Check(  py_obj)) return "string"      ;
> -    if (PyInt_Check(     py_obj)) return "int"         ;
> +    if (PyBytes_Check(  py_obj)) return "string"      ;
> +    if (PyLong_Check(     py_obj)) return "int"         ;
>      if (PyFloat_Check(   py_obj)) return "float"       ;
>      if (PyDict_Check(    py_obj)) return "dict"        ;
>      if (PyList_Check(    py_obj)) return "list"        ;
> @@ -1942,7 +1942,7 @@
>    (PyObject* array = NULL)
>  {
>    npy_intp dims[1];
> -  if (!PyInt_Check($input))
> +  if (!PyLong_Check($input))
>    {
>      const char* typestring = pytype_string($input);
>      PyErr_Format(PyExc_TypeError,
> @@ -1950,7 +1950,7 @@
>                   typestring);
>      SWIG_fail;
>    }
> -  $2 = (DIM_TYPE) PyInt_AsLong($input);
> +  $2 = (DIM_TYPE) PyLong_AsLong($input);
>    dims[0] = (npy_intp) $2;
>    array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
>    if (!array) SWIG_fail;
> @@ -1970,7 +1970,7 @@
>    (PyObject* array = NULL)
>  {
>    npy_intp dims[1];
> -  if (!PyInt_Check($input))
> +  if (!PyLong_Check($input))
>    {
>      const char* typestring = pytype_string($input);
>      PyErr_Format(PyExc_TypeError,
> @@ -1978,7 +1978,7 @@
>                   typestring);
>      SWIG_fail;
>    }
> -  $1 = (DIM_TYPE) PyInt_AsLong($input);
> +  $1 = (DIM_TYPE) PyLong_AsLong($input);
>    dims[0] = (npy_intp) $1;
>    array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
>    if (!array) SWIG_fail;

Reply via email to