From 7bd864c144efd374adc36fe327339a0171ab4a72 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 7 Mar 2019 00:28:50 -0800 Subject: [PATCH] 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 --- src/python/m5/SimObject.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.30.2