diff options
author | Gabe Black <gabeblack@google.com> | 2019-03-07 00:28:50 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-03-14 21:04:29 +0000 |
commit | 7bd864c144efd374adc36fe327339a0171ab4a72 (patch) | |
tree | c622a139698a00a246ca003cc846ec4818bdd8f7 /src/python | |
parent | 1a2a7c76a09186ecf111a62526cd35ade67cfd07 (diff) | |
download | gem5-7bd864c144efd374adc36fe327339a0171ab4a72.tar.xz |
python: Teach cxxMethod how to set return_value_policy.
This is passed through to the underlying call to PyBindMethod.
Change-Id: Ib46c55664ba0707464bb84e137a0fad817aea1bb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17034
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/m5/SimObject.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index 7f19c0776..97f684739 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -882,6 +882,7 @@ def cxxMethod(*args, **kwargs): name = func.__name__ override = kwargs.get("override", False) cxx_name = kwargs.get("cxx_name", name) + return_value_policy = kwargs.get("return_value_policy", None) args, varargs, keywords, defaults = inspect.getargspec(func) if varargs or keywords: @@ -906,7 +907,8 @@ def cxxMethod(*args, **kwargs): return func(self, *args, **kwargs) f = py_call if override else cxx_call - f.__pybind = PyBindMethod(name, cxx_name=cxx_name, args=args) + f.__pybind = PyBindMethod(name, cxx_name=cxx_name, args=args, + return_value_policy=return_value_policy) return f |