Hi Jaipaul,

On 8/11/26 1:11 PM, Jaipaul Cheernam via lists.openembedded.org wrote:
SWIG 4.5.0 removed Python 2 compatibility macros (PyInt_*, PyString_*)
from its runtime. Backport the dtc upstream fix to u-boot's bundled
pylibfdt/libfdt.i to replace them with Python 3 equivalents.

Signed-off-by: Jaipaul Cheernam <[email protected]>
---
  ...-removed-SWIG-Python-2-compatibility.patch | 57 +++++++++++++++++++
  .../u-boot/u-boot-tools_2026.07.bb            |  4 +-
  2 files changed, 60 insertions(+), 1 deletion(-)
  create mode 100644 
meta/recipes-bsp/u-boot/files/0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch

diff --git 
a/meta/recipes-bsp/u-boot/files/0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch
 
b/meta/recipes-bsp/u-boot/files/0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch
new file mode 100644
index 0000000000..5fdccf5e9d
--- /dev/null
+++ 
b/meta/recipes-bsp/u-boot/files/0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch
@@ -0,0 +1,57 @@
+From 32378d7b4383a79d13da9005035600d8f0c8c29d Mon Sep 17 00:00:00 2001
+From: Jitka Plesnikova <[email protected]>
+Date: Tue, 29 Jul 2026 05:55:56 +0000
+Subject: [PATCH] pylibfdt: Replace removed SWIG Python 2 compatibility macros
+
+SWIG 4.5.0 removed Python 2 compatibility macros (PyInt_*, PyString_*)
+from its runtime header pyhead.swg (see commit 79f7a2b7cb7d). Replace
+them with their Python 3 C API equivalents:
+
+- PyString_FromString -> PyUnicode_FromString
+- PyString_AsString -> PyBytes_AsString
+- PyInt_AsLong -> PyLong_AsLong
+
+The replacements are safe since the macros were already aliased to
+these exact functions in SWIG's Python 3 code path.
+
+Signed-off-by: Jitka Plesnikova <[email protected]>
+Signed-off-by: Peter Robinson <[email protected]>
+Signed-off-by: David Gibson <[email protected]>
+(cherry picked from commit 5008d1d6a356b8d0a78060da2e1021507d529cff)
+
+Upstream-Status: Backport 
[https://github.com/dgibson/dtc/commit/5008d1d6a356b8d0a78060da2e1021507d529cff]
+

Not a backport. This commit doesn't exist in U-Boot. Please work with upstream U-Boot on fixing this so that other build systems/distros don't need to duplicate the work and we don't have to carry this patch forever in Yocto.

Cheers,
Quentin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#243199): 
https://lists.openembedded.org/g/openembedded-core/message/243199
Mute This Topic: https://lists.openembedded.org/mt/120699717/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to