]> xenbits.xensource.com Git - xen.git/commit
tools/python: fix Python3.4 TypeError in format string
authorOlaf Hering <olaf@aepfle.de>
Thu, 1 Jul 2021 09:56:01 +0000 (11:56 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 6 Jul 2021 09:49:58 +0000 (10:49 +0100)
commita27976a1080d537fb1f212a8f9133d60daa0025b
treef6de3292799dd5fb3ebe54652df1ef8fb1b244d2
parentc8f88810db2a25d6aacf65c1c60bc4f5d848a483
tools/python: fix Python3.4 TypeError in format string

Using the first element of a tuple for a format specifier fails with
python3.4 as included in SLE12:
    b = b"string/%x" % (i, )
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'

It happens to work with python 2.7 and 3.6.
To support older Py3, format as strings and explicitly encode as ASCII.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
tools/python/scripts/convert-legacy-stream