python: clarify SimObject error message (#1625)

This adds more detail to the error message that is thrown when an orphan
node is instantiated.
This commit is contained in:
Erin (Jianghua) Le
2024-10-07 13:45:03 -07:00
committed by GitHub
parent f5858fe81f
commit 1ee924a067

View File

@@ -1259,7 +1259,9 @@ class SimObject(metaclass=MetaSimObject):
if not self._ccObject:
# Make sure this object is in the configuration hierarchy
if not self._parent and not isRoot(self):
raise RuntimeError("Attempt to instantiate orphan node")
raise RuntimeError(
f"Attempt to instantiate orphan node {self}"
)
# Cycles in the configuration hierarchy are not supported. This
# will catch the resulting recursion and stop.
self._ccObject = -1