summaryrefslogtreecommitdiff
path: root/src/python/m5/util/jobfile.py
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2019-01-26 09:19:22 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2019-02-22 10:47:36 +0000
commit7d71f6641fcb660de0f003e2c028b464d7116ca1 (patch)
treeeab821617b26ce34b0dc834f2e0f11cfee67c2a0 /src/python/m5/util/jobfile.py
parent8e5d168332c4ac3851aee4f815cff0b62b37cc40 (diff)
downloadgem5-7d71f6641fcb660de0f003e2c028b464d7116ca1.tar.xz
python: Make iterator handling Python 3 compatible
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 <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15992 Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/python/m5/util/jobfile.py')
-rw-r--r--src/python/m5/util/jobfile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/python/m5/util/jobfile.py b/src/python/m5/util/jobfile.py
index 613289a81..45214a0b5 100644
--- a/src/python/m5/util/jobfile.py
+++ b/src/python/m5/util/jobfile.py
@@ -40,7 +40,7 @@ class Data(object):
if not isinstance(obj, Data):
raise AttributeError("can only update from Data object")
- for key,val in obj.__dict__.iteritems():
+ for key,val in obj.__dict__.items():
if key.startswith('_') or key in ('name', 'desc'):
continue
@@ -57,7 +57,7 @@ class Data(object):
(key, self.__dict__[key], val))
d = self.__dict__[key]
- for k,v in val.iteritems():
+ for k,v in val.items():
if k in d:
raise AttributeError(
"%s specified more than once in %s" % (k, key))
@@ -100,7 +100,7 @@ class Data(object):
return self.__dict__[key]
def __iter__(self):
- keys = self.__dict__.keys()
+ keys = list(self.__dict__.keys())
keys.sort()
for key in keys:
if not key.startswith('_'):
@@ -115,7 +115,7 @@ class Data(object):
def __repr__(self):
d = {}
- for key,value in self.__dict__.iteritems():
+ for key,value in self.__dict__.items():
if not key.startswith('_'):
d[key] = value