Andreas Sandberg has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/15990 )
Change subject: python: Fix Param initialization issue in Python 3
......................................................................
python: Fix Param initialization issue in Python 3
When initializing a param with a SimObject NULL pointer, convert()
checks if the 'ptype' attribute has been created and whether the value
is NULL. In that case, it assumes that the object is being
initizalized as a part of SimObject initialization and defers the
conversion. This check is implemented using hasattr() which in turn is
implemented using the __getattr__ implementation that asserts because
all SimObjects haven't been initialized yet.
Implement the check using a lookup in the object's dictionary instead
to prevent the SimObject lookup.
Change-Id: I7367563c4fb71f6d2be541ebdc0be418e9f73d48
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/15990
Reviewed-by: Nikos Nikoleris <[email protected]>
---
M src/python/m5/params.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Nikos Nikoleris: Looks good to me, approved
Andreas Sandberg: Looks good to me, approved
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index b5de6ef..5eabce1 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -200,7 +200,7 @@
if isinstance(value, proxy.BaseProxy):
value.set_param_desc(self)
return value
- if not hasattr(self, 'ptype') and isNullPointer(value):
+ if 'ptype' not in self.__dict__ and isNullPointer(value):
# deferred evaluation of SimObject; continue to defer if
# we're just assigning a null pointer
return value
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/15990
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I7367563c4fb71f6d2be541ebdc0be418e9f73d48
Gerrit-Change-Number: 15990
Gerrit-PatchSet: 7
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Ciro Santilli <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev