Bug#1144339: link-grammar: FTBFS with SWIG 4.5.0

Bas Couwenberg <[email protected]>
Newsgroups gmane.linux.debian.devel.bugs.rc
Message-ID <178669017640.3869734.5422925079173500614.reportbug@osiris.linuxminded.xs4all.nl>
Source: link-grammar
Version: 5.13.0+dfsg-1
Severity: serious
Tags: upstream ftbfs patch
Justification: makes the package in question unusable or mostly so

Dear Maintainer,

Your package FTBFS with SWIG 4.5.0 as revealed by debci:

 92s lg_python_wrap.cc: In function 'PyObject* _py_error_printall(PyObject*)':
 92s lg_python_wrap.cc:4256:21: error: 'PyInt_FromLong' was not declared in this scope; did you mean 'PyLong_FromLong'?
 92s  4256 |    PyObject *py_n = PyInt_FromLong(n);
 92s       |                     ^~~~~~~~~~~~~~
 92s       |                     PyLong_FromLong
 92s lg_python_wrap.cc: In function 'PyObject* _wrap__py_error_default_handler(PyObject*, PyObject*)':
 92s lg_python_wrap.cc:9671:12: error: 'PyInt_Check' was not declared in this scope; did you mean 'PySet_Check'?
 92s  9671 |       if (!PyInt_Check(swig_obj[1]))
 92s       |            ^~~~~~~~~~~
 92s       |            PySet_Check
 92s lg_python_wrap.cc:9678:22: error: 'PyInt_AsLong' was not declared in this scope; did you mean 'PyLong_AsLong'?
 92s  9678 |         arg20 = (int)PyInt_AsLong(swig_obj[1]);
 92s       |                      ^~~~~~~~~~~~
 92s       |                      PyLong_AsLong

https://ci.debian.net/packages/l/link-grammar/testing/amd64/74304445/

The attached patch resolves the issue by using PyLong_* instead of PyInt_*.

Kind Regards,

Bas
0001-Add-patch-to-fix-FTBFS-with-swig-4.5.0.patch (application/mbox, 2.1 KB)
From 607899448c81c2bde29dd2eb6449b7b741993d92 Mon Sep 17 00:00:00 2001
From: Bas Couwenberg <[email protected]>
Date: Fri, 14 Aug 2026 08:41:44 +0200
Subject: Add patch to fix FTBFS with swig 4.5.0.

---
 debian/changelog          |  7 +++++++
 debian/patches/series     |  1 +
 debian/patches/swig.patch | 31 +++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)
 create mode 100644 debian/patches/series
 create mode 100644 debian/patches/swig.patch

diff --git a/debian/changelog b/debian/changelog
index f311b49ee..c6d3393b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+link-grammar (5.13.0+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch to fix FTBFS with swig 4.5.0.
+
+ -- Bas Couwenberg <[email protected]>  Fri, 14 Aug 2026 08:41:29 +0200
+
 link-grammar (5.13.0+dfsg-1) unstable; urgency=medium
 
   [ upstream ]
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 000000000..f074960d0
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+swig.patch
diff --git a/debian/patches/swig.patch b/debian/patches/swig.patch
new file mode 100644
index 000000000..4f6643125
--- /dev/null
+++ b/debian/patches/swig.patch
@@ -0,0 +1,31 @@
+Description: Use PyLong_* instead of PyInt_* to fix FTBFS.
+Author: Bas Couwenberg <[email protected]>
+
+--- a/bindings/swig/link_grammar.i
++++ b/bindings/swig/link_grammar.i
+@@ -281,14 +281,14 @@ static void PythonCallBack(lg_errinfo *l
+    }
+    else
+    {
+-      if (!PyInt_Check($input))
++      if (!PyLong_Check($input))
+       {
+          SWIG_exception_fail(SWIG_TypeError, errmsg);
+          error = true;
+       }
+       else
+       {
+-          arg = (int)PyInt_AsLong($input);
++          arg = (int)PyLong_AsLong($input);
+       }
+ 
+       if ((arg < 0) || (arg > lg_None))
+@@ -358,7 +358,7 @@ PyObject *_py_error_printall(PyObject *f
+    int n = lg_error_printall(PythonCallBack, func_and_data);
+    Py_DECREF(func_and_data);
+ 
+-   PyObject *py_n = PyInt_FromLong(n);
++   PyObject *py_n = PyLong_FromLong(n);
+    return py_n;
+ }
+ 
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.