[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] tools/xen-foreign: Update python scripts to be Py3 compatible



On Mon, Mar 11, 2019 at 07:18:40PM +0000, Andrew Cooper wrote:
> The issues are:
>  * dict.has_key() was completely removed in Py3
>  * dict.keys() is an iterable rather than list in Py3, so .sort() doesn't 
> work.
>  * list.sort(cmp=) was deprecated in Py2.4 and removed in Py3.
> 
> The has_key() issue is trivially fixed by switching to using the in keyword.
> The sorting issue could be trivially fixed, but take the opportunity to
> improve the code.
> 
> The reason for the sorting is to ensure that "unsigned long" gets replaced
> before "long", and the only reason sorting is necessary is because
> inttypes[arch] is needlessly a dictionary.  Update inttypes[arch] to be a list
> of tuples rather than a dictionary, and process them in list order.
> 
> Reported-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Much better.

Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.