diff mbox series

[meta-python,3/4] upm: fix removed Python 2 C-API symbol in carrays_uint32_t.i

Message ID 20260814003819.1417656-3-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-python,1/4] python3-fann2: add SWIG py2/py3 C-API compat patch | expand

Commit Message

Khem Raj Aug. 14, 2026, 12:38 a.m. UTC
PyInt_AsLong is a Python 2 C-API name with no fallback definition in
Python 3.14, so any SWIG module that %includes this file (e.g. hmtrp)
fails to compile:

  hmtrpPYTHON_wrap.cxx:7351:14: error: use of undeclared identifier 'PyInt_AsLong'; did you mean 'PyLong_AsLong'?

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...t.i-use-PyLong_AsLong-instead-of-PyI.patch | 23 +++++++++++++++++++
 meta-oe/recipes-extended/upm/upm_git.bb       |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 meta-oe/recipes-extended/upm/upm/0002-carrays_uint32_t.i-use-PyLong_AsLong-instead-of-PyI.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/upm/upm/0002-carrays_uint32_t.i-use-PyLong_AsLong-instead-of-PyI.patch b/meta-oe/recipes-extended/upm/upm/0002-carrays_uint32_t.i-use-PyLong_AsLong-instead-of-PyI.patch
new file mode 100644
index 0000000000..d2703084ac
--- /dev/null
+++ b/meta-oe/recipes-extended/upm/upm/0002-carrays_uint32_t.i-use-PyLong_AsLong-instead-of-PyI.patch
@@ -0,0 +1,23 @@ 
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Subject: carrays_uint32_t.i: use PyLong_AsLong instead of PyInt_AsLong
+
+PyInt_AsLong is a Python 2 C-API name with no fallback definition in
+Python 3.14, so any SWIG module that %includes this file (e.g. hmtrp)
+fails to compile:
+
+  hmtrpPYTHON_wrap.cxx:7351:14: error: use of undeclared identifier 'PyInt_AsLong'; did you mean 'PyLong_AsLong'?
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+--- a/src/carrays_uint32_t.i
++++ b/src/carrays_uint32_t.i
+@@ -45,7 +45,7 @@
+   long v;
+   int res = SWIG_AsVal_long ($input, &v);
+   if (SWIG_IsOK(res)) {
+-    $1 = PyInt_AsLong($input);
++    $1 = PyLong_AsLong($input);
+   }
+   else {
+     SWIG_exception_fail(SWIG_ArgError(res), "failed to convert uint32");
diff --git a/meta-oe/recipes-extended/upm/upm_git.bb b/meta-oe/recipes-extended/upm/upm_git.bb
index 9b809ce727..0257ae8ed7 100644
--- a/meta-oe/recipes-extended/upm/upm_git.bb
+++ b/meta-oe/recipes-extended/upm/upm_git.bb
@@ -17,6 +17,7 @@  SRC_URI = "git://github.com/eclipse/${BPN}.git;protocol=https;branch=master \
            file://0001-cmake-Disable-Wno-misleading-indentation-with-clang-.patch \
            file://0001-cmake-Disable-using-Wno-maybe-uninitialized.patch \
            file://0001-include-missing-cstdint.patch \
+           file://0002-carrays_uint32_t.i-use-PyLong_AsLong-instead-of-PyI.patch \
            "

 SRC_URI:append:toolchain-clang:x86 = " file://0001-nmea_gps-Link-with-latomic.patch "