Package: src:s2geometry
Version: 0.10.0-6
User: [email protected]
Usertags: python3.15
Tags: patch, ftbfs, forky, sid
Severity: serious

Hi!

While rebuilding the python related packages against the Python 3.15rc1
version we found that s2geometry fails to build from source [1]. And it
also fails on Debian buildds, as it fails for 3.14 as well [2].

One of the many errors:

/build/reproducible-path/s2geometry-0.10.0/.pybuild/cpython3_3.14/build/python/CMakeFiles/_pywraps2.dir/s2PYTHON_wrap.cxx:18298:9:
error: ‘SWIG_Python_TypeError’ was not declared in this scope; did you
mean ‘SWIG_Python_TypeQuery’?

As upstream points out in its fix SWIG_Python_TypeError was removed in
SWIG 4.4, so the .i file needs to be updated.

I applied the upstream fix [4] in the sandbox [3] to be able to build the 
packages
that depend on s2geometry, please consider applying the patch to support
the upcoming 3.15 version.

Happy hacking,

[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4243268/
[2]: 
https://buildd.debian.org/status/fetch.php?pkg=s2geometry&arch=amd64&ver=0.10.0-6.1%2Bb2&stamp=1711976885&raw=0
[3]: https://debusine.debian.net/debian/r-python-python3.15/
[4]: https://github.com/google/s2geometry/issues/487

--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
From 33c202ab7ae4f1e508371c3df65f2eb2fa5143d8 Mon Sep 17 00:00:00 2001
From: Jesse Rosenstock <[email protected]>
Date: Tue, 6 Jan 2026 11:30:23 +0100
Subject: [PATCH] SWIG: Ensure SWIG 4.4 compatibility (#510)

SWIG_Python_TypeError was removed in SWIG 4.4.
Use %argument_fail instead.

Fixes https://github.com/google/s2geometry/issues/487.

Origin: upstream, commit:33c202a
---
 src/python/s2_common.i | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/python/s2_common.i b/src/python/s2_common.i
index ba56bf8..3445511 100755
--- a/src/python/s2_common.i
+++ b/src/python/s2_common.i
@@ -103,29 +103,29 @@
 %apply int *OUTPUT {int *orientation};
 %apply SWIGTYPE *DISOWN {S2Loop *loop_disown};
 
-%typemap(in) std::vector<S2Loop *> * (std::vector<S2Loop *> loops){
-  PyObject *element(nullptr);
-  PyObject *iterator(PyObject_GetIter($input));
-  if (!iterator) {
-    SWIG_fail;
-  }
-  int i(0);
-  while ((element = PyIter_Next(iterator))) {
-    i++;
-    S2Loop *loop(nullptr);
-    int res(SWIG_ConvertPtr(element, (void **)&loop, $descriptor(S2Loop *), 0));
-    if (SWIG_IsOK(res)) {
-      loops.push_back(loop->Clone());
-    } else {
-      SWIG_Python_TypeError(SWIG_TypePrettyName($descriptor(S2Loop *)), element);
-      SWIG_Python_ArgFail(i);
-      Py_DECREF(element);
-      Py_DECREF(iterator);
-      SWIG_fail;
-    }
-    Py_DECREF(element);
-  }
-  Py_DECREF(iterator);
+%typemap(in) std::vector<S2Loop *> * (std::vector<S2Loop *> loops) {
+  PyObject *iter = PyObject_GetIter($input);
+  if (iter == nullptr) {
+    %argument_fail(SWIG_TypeError, "iterable of S2Loop *", $symname, $argnum);
+  }
+
+  for (PyObject *elem; (elem = PyIter_Next(iter)); Py_DECREF(elem)) {
+    S2Loop *loop = nullptr;
+    int res = SWIG_ConvertPtr(
+        elem, reinterpret_cast<void **>(&loop), $descriptor(S2Loop *),
+        SWIG_POINTER_NO_NULL);
+
+    if (!SWIG_IsOK(res)) {
+      Py_DECREF(elem);
+      Py_DECREF(iter);
+      for (S2Loop *loop : loops) delete loop;
+      %argument_fail(res, "$type", $symname, $argnum);
+    }
+
+    loops.push_back(loop->Clone());
+  }
+
+  Py_DECREF(iter);
   $1 = &loops;
 }
 

Reply via email to