dgibson / dtc

Device Tree Compiler
219 stars 130 forks source link

pylibfdt: fix with Python 3.10 #61

Closed rossburton closed 2 years ago

rossburton commented 2 years ago

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

dgibson commented 2 years ago

For future reference, you don't need to send a github PR and a direct email. Either one is fine. In any case I've applied this with a manual correction from the email version, so I'm closing this.

rossburton commented 2 years ago

Wasn't sure what the 'preferred' method is. If both are good then I'll stick with PRs.