diff options
author | Geoffrey Blake <Geoffrey.Blake@arm.com> | 2014-05-09 18:58:47 -0400 |
---|---|---|
committer | Geoffrey Blake <Geoffrey.Blake@arm.com> | 2014-05-09 18:58:47 -0400 |
commit | 0c1913336af42b6d789fa7738690e64b7784d9df (patch) | |
tree | f59124a9ed0c0feb3f090324b1688ff8ae2e3641 /src/python/m5/SimObject.py | |
parent | 85940fd53795bd4b7b2118f4fa2a59a03bf6a8b1 (diff) | |
download | gem5-0c1913336af42b6d789fa7738690e64b7784d9df.tar.xz |
config: Avoid generating a reference to myself for Parent.any
The unproxy code for Parent.any can generate a circular reference
in certain situations with classes hierarchies like those in ClockDomain.py.
This patch solves this by marking ouself as visited to make sure the
search does not resolve to a self-reference.
Diffstat (limited to 'src/python/m5/SimObject.py')
-rw-r--r-- | src/python/m5/SimObject.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index 30c968380..3784c716e 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -861,7 +861,11 @@ class SimObject(object): found_obj = None for child in self._children.itervalues(): - if isinstance(child, ptype): + visited = False + if hasattr(child, '_visited'): + visited = getattr(child, '_visited') + + if isinstance(child, ptype) and not visited: if found_obj != None and child != found_obj: raise AttributeError, \ 'parent.any matched more than one: %s %s' % \ |