python: Improve SimObject's warning when parent specified twice
SimObject outputs a warning when its parent is specified more than once. The cause is most likely that there is unexpected param specified in the constructor called in the Python interface. This commit adds a note about this probable cause of this potential error to the warning message. Change-Id: I9b6bf5d5fb0c77bfdad5fde42e88f814e8a4b72b Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38359 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -1484,8 +1484,9 @@ class SimObject(object):
|
||||
def add_child(self, name, child):
|
||||
child = coerceSimObjectOrVector(child)
|
||||
if child.has_parent():
|
||||
warn("add_child('%s'): child '%s' already has parent", name,
|
||||
child.get_name())
|
||||
warn(f"{self}.{name} already has parent (Previously declared as "
|
||||
f"{child._parent}.{name}).\n"
|
||||
f"\tNote: {name} is not a parameter of {type(self).__name__}")
|
||||
if name in self._children:
|
||||
# This code path had an undiscovered bug that would make it fail
|
||||
# at runtime. It had been here for a long time and was only
|
||||
|
||||
Reference in New Issue
Block a user