remove inspect.getargspec deprecation warning
In python 3 inspect.getargspec is deprecated and replaced with inspect.getfullargspec which does not exist on python 2.7. This change uses six to select the correct version to use based on the python version used. Change-Id: I234a3509ff850d0c5616ebcfa240212b03db9e76 Closes-Bug: #1814288
This commit is contained in:
parent
971b9e62df
commit
5d1f322542
@ -141,8 +141,14 @@ class PythonScript(base.BaseScript):
|
||||
script_func = self._func(funcname)
|
||||
|
||||
# check for old way of using engine
|
||||
if not inspect.getargspec(script_func)[0]:
|
||||
raise TypeError("upgrade/downgrade functions must accept engine"
|
||||
arg_spec = None
|
||||
if six.PY2:
|
||||
arg_spec = inspect.getargspec(script_func)
|
||||
else:
|
||||
arg_spec = inspect.getfullargspec(script_func)
|
||||
if not arg_spec[0]:
|
||||
raise TypeError(
|
||||
"upgrade/downgrade functions must accept engine"
|
||||
" parameter (since version 0.5.4)")
|
||||
|
||||
script_func(engine)
|
||||
|
Loading…
Reference in New Issue
Block a user