summaryrefslogtreecommitdiff
path: root/src/python/m5
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2018-06-05 17:15:58 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2018-06-21 14:21:44 +0000
commit7ad7ea26b5b11d4fa392282c2e6159d0089d0342 (patch)
treed8cc5cded04ea0da834109e3e2d2f7677fca9b68 /src/python/m5
parent48e420cbd5d9ab9d56d4b837ca9fda65170dba3a (diff)
downloadgem5-7ad7ea26b5b11d4fa392282c2e6159d0089d0342.tar.xz
sim: Use the canonical way of iterating over a dictionary
Instead of using a convoluted getattr call, use the conventional iteritems() interface. Change-Id: I6d6bbccf865f8a0e8ff0767914157a7460099b09 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/10782 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/python/m5')
-rw-r--r--src/python/m5/SimObject.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 0c9e738f6..47e647467 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1520,11 +1520,10 @@ class SimObject(object):
yield # make this function a (null) generator
def recurseDeviceTree(self, state):
- for child in [getattr(self, c) for c in self._children]:
+ for child in self._children.itervalues():
for item in child: # For looping over SimObjectVectors
- if isinstance(item, SimObject):
- for dt in item.generateDeviceTree(state):
- yield dt
+ for dt in item.generateDeviceTree(state):
+ yield dt
# Function to provide to C++ so it can look up instances based on paths
def resolveSimObject(name):