From 498ab5224b151355dd29bb2f1df7e9c574696321 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau <elfosardo@gmail.com> Date: Wed, 1 Jul 2020 17:25:09 +0200 Subject: [PATCH] Use getfullargspec to inspect functions The getfullargspec [1] function is maintained to provide compatibility with the deprecatad getargspec [2]. [1] https://docs.python.org/3/library/inspect.html#inspect.getfullargspec [2] https://docs.python.org/3/library/inspect.html#inspect.getargspec Change-Id: Ibf78672c15702af43ed2ee1256517b1a1a895120 --- ironic/api/expose.py | 2 +- ironic/api/functions.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ironic/api/expose.py b/ironic/api/expose.py index 94c0e8d76e..71bfa15005 100644 --- a/ironic/api/expose.py +++ b/ironic/api/expose.py @@ -123,7 +123,7 @@ def expose(*args, **kwargs): ) pecan_json_decorate(callfunction) - pecan.util._cfg(callfunction)['argspec'] = inspect.getargspec(f) + pecan.util._cfg(callfunction)['argspec'] = inspect.getfullargspec(f) callfunction._wsme_definition = funcdef return callfunction diff --git a/ironic/api/functions.py b/ironic/api/functions.py index 8b4cebbdd7..8554bd7e42 100644 --- a/ironic/api/functions.py +++ b/ironic/api/functions.py @@ -37,7 +37,8 @@ def wrapfunc(f): def getargspec(f): f = getattr(f, '_wsme_original_func', f) - return inspect.getargspec(f) + func_argspec = inspect.getfullargspec(f) + return func_argspec[0:4] class FunctionArgument(object):