SimObject: allow modules in subclass definitions

In particular, this avoids crashing when you do
an import (like "import pdb") inside a SimObject
subclass definition.
This commit is contained in:
Steve Reinhardt 2011-06-01 21:43:13 -07:00
parent 07e5b15953
commit 6a1be32a72

View file

@ -29,7 +29,7 @@
# Nathan Binkert # Nathan Binkert
import sys import sys
from types import FunctionType, MethodType from types import FunctionType, MethodType, ModuleType
try: try:
import pydot import pydot
@ -130,7 +130,8 @@ def default_swig_objdecls(cls, code):
def public_value(key, value): def public_value(key, value):
return key.startswith('_') or \ 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 # The metaclass for SimObject. This class controls how new classes
# that derive from SimObject are instantiated, and provides inherited # that derive from SimObject are instantiated, and provides inherited