Andreas Sandberg has submitted this change and it was merged. (
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 <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/15993
Reviewed-by: Giacomo Travaglini <[email protected]>
Reviewed-by: Juha Jäykkä <[email protected]>
---
M src/python/m5/params.py
M src/python/m5/proxy.py
2 files changed, 5 insertions(+), 6 deletions(-)
Approvals:
Giacomo Travaglini: Looks good to me, approved
Juha Jäykkä: Looks good to me, but someone else must approve
Andreas Sandberg: Looks good to me, approved
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 72cc0b2..757a4f2 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -73,12 +73,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 = {}
@@ -175,6 +178,7 @@
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 @@
'NextEthernetAddr', 'NULL',
'MasterPort', 'SlavePort',
'VectorMasterPort', 'VectorSlavePort']
-
-from . import SimObject
diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py
index 346ed92..b939bc0 100644
--- a/src/python/m5/proxy.py
+++ b/src/python/m5/proxy.py
@@ -50,7 +50,6 @@
import copy
-from . import params
class BaseProxy(object):
def __init__(self, search_self, search_up):
@@ -235,6 +234,7 @@
return 'all'
def isproxy(obj):
+ from . import params
if isinstance(obj, (BaseProxy, params.EthernetAddr)):
return True
elif isinstance(obj, (list, tuple)):
@@ -264,6 +264,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: 9
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Ciro Santilli <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Juha Jäykkä <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev