diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2005-06-03 16:21:37 -0400 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2005-06-03 16:21:37 -0400 |
commit | af3add2e331fd1c77b5c83b65bcc7ba30d831ac8 (patch) | |
tree | 27e07a287671bdbdedbc927db7f0c20cef23d4ff /python/m5/config.py | |
parent | 22eccce34ba7d803d3f46ffeef80925a5e5ff2e3 (diff) | |
download | gem5-af3add2e331fd1c77b5c83b65bcc7ba30d831ac8.tar.xz |
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
Diffstat (limited to 'python/m5/config.py')
-rw-r--r-- | python/m5/config.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python/m5/config.py b/python/m5/config.py index 48d945d14..091df3662 100644 --- a/python/m5/config.py +++ b/python/m5/config.py @@ -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 |