Andreas Sandberg has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/15993
Change subject: python: Fix params/proxy import loop
......................................................................
python: Fix params/proxy import loop
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 <andreas.sandb...@arm.com>
---
M src/python/m5/params.py
M src/python/m5/proxy.py
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index cdc0f9e..9176967 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -77,12 +77,15 @@
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 = {}
@@ -181,6 +184,7 @@
def __getattr__(self, attr):
if attr == 'ptype':
+ from . import SimObject
ptype = SimObject.allClasses[self.ptype_str]
assert isSimObjectClass(ptype)
self.ptype = ptype
@@ -2107,5 +2111,3 @@
'NextEthernetAddr', 'NULL',
'MasterPort', 'SlavePort',
'VectorMasterPort', 'VectorSlavePort']
-
-from . import SimObject
diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py
index b7a509b..5128156 100644
--- a/src/python/m5/proxy.py
+++ b/src/python/m5/proxy.py
@@ -53,7 +53,6 @@
import copy
-from . import params
class BaseProxy(object):
def __init__(self, search_self, search_up):
@@ -238,6 +237,7 @@
return 'all'
def isproxy(obj):
+ from . import params
if isinstance(obj, (BaseProxy, params.EthernetAddr)):
return True
elif isinstance(obj, (list, tuple)):
@@ -267,6 +267,3 @@
# limit exports on 'from proxy import *'
__all__ = ['Parent', 'Self']
-
-# see comment on imports at end of __init__.py.
-import params # for EthernetAddr
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/15993
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I770112fd3c07c395459e204976942bda3dc7236f
Gerrit-Change-Number: 15993
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev