Andreas Sandberg has submitted this change and it was merged. (
https://gem5-review.googlesource.com/10782 )
Change subject: sim: Use the canonical way of iterating over a dictionary
......................................................................
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 <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/10782
Reviewed-by: Jason Lowe-Power <[email protected]>
---
M src/python/m5/SimObject.py
1 file changed, 3 insertions(+), 4 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Andreas Sandberg: Looks good to me, approved
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 0c9e738..47e6474 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1520,11 +1520,10 @@
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):
--
To view, visit https://gem5-review.googlesource.com/10782
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I6d6bbccf865f8a0e8ff0767914157a7460099b09
Gerrit-Change-Number: 10782
Gerrit-PatchSet: 5
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Curtis Dunham <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev