summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Charkov <[email protected]>2026-08-24 17:12:58 +0400
committerTom Rini <[email protected]>2026-08-31 17:06:20 -0600
commit9f6d57eaef77a17fafe0d28e4a103786ae2de55f (patch)
tree506a51bbe1d8ddd6320d3e6b3efcdc4e82e851c2
parent6073c36b2c8d39afe3ecc789b281667a3ddebc70 (diff)
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 <[email protected]>
-rw-r--r--scripts/dtc/pylibfdt/libfdt.i_shipped4
1 files 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
}