Andreas Sandberg has uploaded this change for review. (
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]>
---
M src/python/m5/SimObject.py
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 6e61961..6ec7bae 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1508,11 +1508,10 @@
yield # make this function a (null) generator
def recurseDeviceTree(self, state):
- for child in [getattr(self, c) for c in self._children]:
+ for (name, child) in sorted(self._children.iteritems()):
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: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev