Bobby Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/68817?usp=email )
Change subject: python: Replace 'getargspec' with 'signature' in
SimObject.py
......................................................................
python: Replace 'getargspec' with 'signature' in SimObject.py
In Python 3.11 'inspect.getargspec' has been removed. It has been
marked for deprecation since 3.5. The SimObject.py class has therefore
been rewritten to use 'inspect.signature' instead.
M src/python/m5/SimObject.py
1 file changed, 15 insertions(+), 13 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 6caa532..354a828 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -478,19 +478,21 @@
return_value_policy = kwargs.get("return_value_policy", None)
static = kwargs.get("static", False)
args, varargs, keywords, defaults = inspect.getargspec(func)
if varargs or keywords:
raise ValueError(
"Wrapped methods must not contain variable arguments"
)
# Create tuples of (argument, default)
if defaults:
args = args[: -len(defaults)] + list(
zip(args[-len(defaults) :], defaults)
)
# Don't include self in the argument list to PyBind
args = args[1:]
# Create a list of tuples of (argument, default). The
PyBindMethod
# class expects the `args` argument to be a list of either argument
# names, in the case that argument does not have a default value,
and
# a tuple of (argument, default) in the casae where an argument
does.
args = []
sig = inspect.signature(func)
for param_name in sig.parameters.keys():
if param_name == "self":
# We don't cound 'self' as an argument in this case.
continue
param = sig.parameters[param_name]
if param.default is param.empty:
args.append(param_name)
else:
args.append((param_name, param.default))
@wraps(func)
def cxx_call(self, *args, **kwargs):
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/68817?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I9efd831e05e0b1619f366ffe722abb0a072fd519
Gerrit-Change-Number: 68817
Gerrit-PatchSet: 4
Gerrit-Owner: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Andreas Sandberg andreas.sandberg@arm.com
Gerrit-Reviewer: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Jason Lowe-Power jason@lowepower.com
Gerrit-Reviewer: Jason Lowe-Power power.jg@gmail.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com
Gerrit-MessageType: merged