aboutsummaryrefslogtreecommitdiff
path: root/pylibfdt
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2021-11-11 16:05:36 +0000
committerDavid Gibson <david@gibson.dropbear.id.au>2021-11-12 12:45:46 +1100
commit383e148b70a47ab15f97a19bb999d54f9c3e810f (patch)
tree970e7bf1c1a65c667f8f0caa58e6b378312dd575 /pylibfdt
parent23b56cb7e18992650c79a04c9e4e3f2740bc1fbd (diff)
downloaddtc-383e148b70a47ab15f97a19bb999d54f9c3e810f.zip
dtc-383e148b70a47ab15f97a19bb999d54f9c3e810f.tar.gz
dtc-383e148b70a47ab15f97a19bb999d54f9c3e810f.tar.bz2
pylibfdt: fix with Python 3.10
Since Python 2.5 the argument parsing functions when parsing expressions such as s# (string plus length) expect the length to be an int or a ssize_t, depending on whether PY_SSIZE_T_CLEAN is defined or not. Python 3.8 deprecated the use of int, and with Python 3.10 this symbol must be defined and ssize_t used[1]. Define the magic symbol when building the extension, and cast the ints from the libfdt API to ssize_t as appropriate. [1] https://docs.python.org/3.10/whatsnew/3.10.html#id2 Signed-off-by: Ross Burton <ross.burton@arm.com> Message-Id: <20211111160536.2516573-1-ross.burton@arm.com> [dwg: Adjust for new location of setup.py] Tested-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pylibfdt')
-rw-r--r--pylibfdt/libfdt.i4
1 files changed, 2 insertions, 2 deletions
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index 51ee801..075ef70 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -1044,9 +1044,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
}