Please, forget my previous message. It was sent to the wrong address.

Best,

Rafael

* Rafael Laboissière <[email protected]> [2026-08-30 14:20]:

> Control: tags -1 + patch 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 have submitted a patch to fix the FTBFS issue as a merge request at Salsa. 
> [2]
>
> Note that there is currently a pull request in the upstream Git repository 
> related to the current issue (PR #2391 [3]).
>
> Best,
>
> Rafael
>
> [1] 
> https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d
> [2] https://salsa.debian.org/debian/openscap/-/merge_requests/2
> [3] https://github.com/OpenSCAP/openscap/pull/2391/

> 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