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
This commit is contained in:
Riccardo Pittau 2020-07-01 17:25:09 +02:00
parent 57b619bf80
commit 498ab5224b
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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):