Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/43905 )
Change subject: python: If a SimObject already has a parent, don't add it
as a child.
......................................................................
python: If a SimObject already has a parent, don't add it as a child.
The SimObject will have already been added to the other object's list
of children, and if it's given a new parent, it will be added as a
child to the new parent as well. The object will then be the child of
two other SimObjects which will cause a delightful variety of hard to
debug problems.
Another slightly better way to handle this situation would be to both
move to the new parent and also remove the SimObject from the original
parent's list of children. Unfortunately there isn't a simple way to
figure out what the parent called the child, and so we would have to
look through its children one by one until we found the right one.
Change-Id: I8f43dfab7adf58a43f806390a0c7c35a2efde11a
---
M src/python/m5/SimObject.py
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index bdce718..65ec7d1 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1480,6 +1480,7 @@
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__}")
+ return
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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/43905
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8f43dfab7adf58a43f806390a0c7c35a2efde11a
Gerrit-Change-Number: 43905
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s