Python 3 compatibility fixes

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJcSxeIAAoJECgHk2+YTcWmwGgQAK0R2abxoAvDlT2hM8vM28jc
 5SyGvthMprX11Xw2AP9t7tU+U/YaICW2EQNmk4jmzGvfxKRUZzjFIFao0W3heC8k
 OQwm9Y8CoAdWtiM4oIBUGX0+H7doef9OZlDpHuqcQF29WDvFTgbOUs84U2col+NW
 Il4RVy8FnZ9pEnOWupeMFuLXZuS3rVZ0+EhToyq/OfgQB9MihPvxSGPmVsbjBu+I
 zNIrTl7zRQJnOoz5RaL7MzV/Dz3Pju/W5wyysNEC2piNdTIEZckRnPL1ypjYeaNK
 pQ7xfu+YTPjAZhb3Jrx8ZYIJx1Ho62ArsIWQVRF+8Vna0wEfQpnwGdV3XPAtpZ61
 p0QL1nP0BEK93Q1UsK9xDjL7SbSY7p24ZSNUyoRlCuSocHMmENeOdc+gcJ5/xfUX
 Ukf5xboA2xFOP+R/sFG0h+cdAfViIfbViIx+Do/tzeyc35KLVwxAFMhwDVtvTON0
 Kw1sWJHnfuSxrlDhZ3w88UB1t3R9KxUtZsi3xavosRaX87v3G2MXDAv1tjuktWEI
 XH13JYhTU1R7WUEqsenSiR/u0truoIRYUbWGbABxmDU0BTWI9k4ZIwAzsozYi8cZ
 r+GOOd6NzSq4LZ2J90465doMRQvmhTOeaDyZ8T4MLthYjbfxRSopcJpRwwGfuPvW
 q2NzQ30RR5zoRCN/zqGx
 =xAEc
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging

Python 3 compatibility fixes

# gpg: Signature made Fri 25 Jan 2019 14:04:56 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  decodetree: re.fullmatch was added in 3.4
  device-crash-test: Python 3 compatibility fix

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-01-25 17:22:20 +00:00
commit ad7a21e812
2 changed files with 3 additions and 2 deletions

View File

@ -204,7 +204,7 @@ def output(*args):
output_fd.write(a)
if sys.version_info >= (3, 0):
if sys.version_info >= (3, 4):
re_fullmatch = re.fullmatch
else:
def re_fullmatch(pat, str):

View File

@ -557,7 +557,8 @@ def main():
logger.info("Skipped %d test cases", skipped)
if args.debug:
stats = sorted([(len(wl_stats.get(i, [])), wl) for i, wl in enumerate(ERROR_WHITELIST)])
stats = sorted([(len(wl_stats.get(i, [])), wl) for i, wl in
enumerate(ERROR_WHITELIST)], key=lambda x: x[0])
for count, wl in stats:
dbg("whitelist entry stats: %d: %r", count, wl)