From 7ad7ea26b5b11d4fa392282c2e6159d0089d0342 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Tue, 5 Jun 2018 17:15:58 +0100 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/10782 Reviewed-by: Jason Lowe-Power --- src/python/m5/SimObject.py | 7 +++---- 1 file 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): -- 2.30.2