Jason Lowe-Power has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/59049 )

Change subject: python: Add error for creating abstact SimObjects
......................................................................

python: Add error for creating abstact SimObjects

Currently, if you try to instantiate an abstract SimObject the error is
confusing and unhelpful.

"TypeError: _m5.param_<type>.<type>Params: No constructor defined!"

Now, it will instead say "Cannot instantiate an abstract SimObject"
and include the name of the object that causes the error.

Change-Id: Ia8c51e29dccd999ec90dcd39710cc91d9a5fb86f
Signed-off-by: Jason Lowe-Power <ja...@lowepower.com>
---
M src/python/m5/SimObject.py
1 file changed, 20 insertions(+), 0 deletions(-)



diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 26a1227..26147a1 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1175,6 +1175,8 @@

     # Call C++ to create C++ object corresponding to this object
     def createCCObject(self):
+        if self.abstract:
+ fatal(f"Cannot instantiate an abstract SimObject ({self.path()})")
         self.getCCParams()
         self.getCCObject() # force creation


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/59049
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: Ia8c51e29dccd999ec90dcd39710cc91d9a5fb86f
Gerrit-Change-Number: 59049
Gerrit-PatchSet: 1
Gerrit-Owner: Jason Lowe-Power <ja...@lowepower.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

Reply via email to