From f4d3080f4586147b9ee962770110944467b26c0c Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Sat, 26 Jan 2019 09:23:16 +0000 Subject: python: Fix params/proxy import loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a circular dependency between params and proxy at import time. This causes issues for Python 3. Add the imports to the specific methods with the dependencies to make the import happen when the method is executed instead. Change-Id: I770112fd3c07c395459e204976942bda3dc7236f Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/15993 Reviewed-by: Giacomo Travaglini Reviewed-by: Juha Jäykkä --- src/python/m5/params.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/python/m5/params.py') diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 72cc0b2ad..757a4f238 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -73,12 +73,15 @@ from . import ticks from .util import * def isSimObject(*args, **kwargs): + from . import SimObject return SimObject.isSimObject(*args, **kwargs) def isSimObjectSequence(*args, **kwargs): + from . import SimObject return SimObject.isSimObjectSequence(*args, **kwargs) def isSimObjectClass(*args, **kwargs): + from . import SimObject return SimObject.isSimObjectClass(*args, **kwargs) allParams = {} @@ -175,6 +178,7 @@ class ParamDesc(object): def __getattr__(self, attr): if attr == 'ptype': + from . import SimObject ptype = SimObject.allClasses[self.ptype_str] assert isSimObjectClass(ptype) self.ptype = ptype @@ -2158,5 +2162,3 @@ __all__ = ['Param', 'VectorParam', 'NextEthernetAddr', 'NULL', 'MasterPort', 'SlavePort', 'VectorMasterPort', 'VectorSlavePort'] - -from . import SimObject -- cgit v1.2.3