From 9f6d57eaef77a17fafe0d28e4a103786ae2de55f Mon Sep 17 00:00:00 2001 From: Alexey Charkov Date: Mon, 24 Aug 2026 17:12:58 +0400 Subject: pylibfdt: Cast property length to Py_ssize_t Commit 7d01bb1c5a1d ("libfdt: Fix build with python 3.10") took only half of the upstream fix, dtc commit 383e148b70a4 ("pylibfdt: fix with Python 3.10"): it defines PY_SSIZE_T_CLEAN but leaves the length argument passed to Py_BuildValue() as a plain int. With PY_SSIZE_T_CLEAN in effect the "y#" and "s#" converters read a Py_ssize_t, so passing an int is undefined behaviour that happens to work only where the two share a representation. Take the remaining hunk so the typemap matches upstream and the subsequent upstream imports apply verbatim. Signed-off-by: Alexey Charkov --- scripts/dtc/pylibfdt/libfdt.i_shipped | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped index 326a15c7941..eb075c0b92b 100644 --- a/scripts/dtc/pylibfdt/libfdt.i_shipped +++ b/scripts/dtc/pylibfdt/libfdt.i_shipped @@ -1049,9 +1049,9 @@ typedef uint32_t fdt32_t; $result = Py_None; else %#if PY_VERSION_HEX >= 0x03000000 - $result = Py_BuildValue("y#", $1, *arg4); + $result = Py_BuildValue("y#", $1, (Py_ssize_t)*arg4); %#else - $result = Py_BuildValue("s#", $1, *arg4); + $result = Py_BuildValue("s#", $1, (Py_ssize_t)*arg4); %#endif } -- cgit v1.3.1