From 7d71f6641fcb660de0f003e2c028b464d7116ca1 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Sat, 26 Jan 2019 09:19:22 +0000 Subject: python: Make iterator handling Python 3 compatible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many functions that used to return lists (e.g., dict.items()) now return iterators and their iterator counterparts (e.g., dict.iteritems()) have been removed. Switch calls to the Python 2.7 iterator methods to use the Python 3 equivalent and add explicit list conversions where necessary. Change-Id: I0c18114955af8f4932d81fb689a0adb939dafaba Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/15992 Reviewed-by: Juha Jäykkä Reviewed-by: Jason Lowe-Power --- src/python/m5/util/terminal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/python/m5/util/terminal.py') diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py index 9dc5d9850..00f8b7061 100644 --- a/src/python/m5/util/terminal.py +++ b/src/python/m5/util/terminal.py @@ -63,7 +63,7 @@ capability_map = { 'Normal': 'sgr0' } -capability_names = capability_map.keys() +capability_names = list(capability_map.keys()) def null_cap_string(s, *args): return '' @@ -84,7 +84,7 @@ class ColorStrings(object): def __init__(self, cap_string): for i, c in enumerate(color_names): setattr(self, c, cap_string('setaf', i)) - for name, cap in capability_map.iteritems(): + for name, cap in capability_map.items(): setattr(self, name, cap_string(cap)) termcap = ColorStrings(cap_string) -- cgit v1.2.3