Bug fix & cleanup in config code.
python/m5/config.py: Bug fix: code was silently converting between incompatible SimObject types as an unintended side-effect of the object cloning support. --HG-- extra : convert_revision : 236f4fe5370f2eddf8af8fab68e2b83dccc34305
This commit is contained in:
parent
22eccce34b
commit
af3add2e33
1 changed files with 4 additions and 0 deletions
|
@ -291,6 +291,10 @@ class SimObject(object):
|
|||
|
||||
def __init__(self, _value_parent = None, **kwargs):
|
||||
self._children = {}
|
||||
if _value_parent and type(_value_parent) != type(self):
|
||||
# this was called as a type conversion rather than a clone
|
||||
raise TypeError, "Cannot convert %s to %s" % \
|
||||
(_value_parent.__class__.__name__, self.__class__.__name__)
|
||||
if not _value_parent:
|
||||
_value_parent = self.__class__
|
||||
# clone values
|
||||
|
|
Loading…
Reference in a new issue