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.
This commit is contained in:
Geoffrey Blake
2014-05-09 18:58:47 -04:00
parent 85940fd537
commit 0c1913336a
2 changed files with 23 additions and 5 deletions

View File

@@ -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' % \