diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-06-01 21:43:13 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-06-01 21:43:13 -0700 |
commit | 6a1be32a7277c59f13f354bec8ece868043ac0cd (patch) | |
tree | cd19737fb6b8697dc092548c3e446317117a4478 /src | |
parent | 07e5b15953741029bd58e21844824615d0108099 (diff) | |
download | gem5-6a1be32a7277c59f13f354bec8ece868043ac0cd.tar.xz |
SimObject: allow modules in subclass definitions
In particular, this avoids crashing when you do
an import (like "import pdb") inside a SimObject
subclass definition.
Diffstat (limited to 'src')
-rw-r--r-- | src/python/m5/SimObject.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index a143958f0..c18d6900c 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -29,7 +29,7 @@ # Nathan Binkert import sys -from types import FunctionType, MethodType +from types import FunctionType, MethodType, ModuleType try: import pydot @@ -130,7 +130,8 @@ def default_swig_objdecls(cls, code): def public_value(key, value): return key.startswith('_') or \ - isinstance(value, (FunctionType, MethodType, classmethod, type)) + isinstance(value, (FunctionType, MethodType, ModuleType, + classmethod, type)) # The metaclass for SimObject. This class controls how new classes # that derive from SimObject are instantiated, and provides inherited |