From 0abef82db8dbd927ee1dfcf20023bcd7a97e18aa Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 11 Apr 2021 02:11:12 -0700 Subject: [PATCH] python: Don't try setting the parent of null SimObject pointers. The line of code which would have added the null SimObject as a child was already guarded by an if, but the line before it which would set the parent of the null SimObject itself was not. This change moves it into the if as well. Change-Id: Icfbc0e87e0ab55917735f720de4e94c19185df46 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44387 Reviewed-by: Daniel Carvalho Maintainer: Gabe Black Tested-by: kokoro --- src/python/m5/SimObject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index 8552939101..766b722278 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -1487,8 +1487,8 @@ class SimObject(object, metaclass=MetaSimObject): # exposed by a buggy script. Changes here will probably not be # exercised without specialized testing. self.clear_child(name) - child.set_parent(self, name) if not isNullPointer(child): + child.set_parent(self, name) self._children[name] = child # Take SimObject-valued parameters that haven't been explicitly