From: Gabe Black Date: Thu, 7 Mar 2019 08:28:50 +0000 (-0800) Subject: python: Teach cxxMethod how to set return_value_policy. X-Git-Tag: v19.0.0.0~1055 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7bd864c144efd374adc36fe327339a0171ab4a72;p=gem5.git 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 Maintainer: Andreas Sandberg --- 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