From 84f296062a48d30a6c1497e523c21ef3fd9ab534 Mon Sep 17 00:00:00 2001 From: Marcus Crane Date: Fri, 26 Oct 2018 10:52:19 +1300 Subject: [PATCH 1/3] Updated inspect method --- invoke/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: invoke-1.3.0/invoke/tasks.py =================================================================== --- invoke-1.3.0.orig/invoke/tasks.py +++ invoke-1.3.0/invoke/tasks.py @@ -4,7 +4,6 @@ generate new tasks. """ from copy import deepcopy -import inspect import types from .context import Context @@ -16,6 +15,11 @@ if six.PY3: else: from itertools import izip_longest as zip_longest +try: + from inspect import getfullargspec as getargspec +except ImportError: + from inspect import getargspec + #: Sentinel object representing a truly blank value (vs ``None``). NO_DEFAULT = object() @@ -150,7 +154,7 @@ class Task(object): # TODO: __call__ exhibits the 'self' arg; do we manually nix 1st result # in argspec, or is there a way to get the "really callable" spec? func = body if isinstance(body, types.FunctionType) else body.__call__ - spec = inspect.getargspec(func) + spec = getargspec(func) arg_names = spec.args[:] matched_args = [reversed(x) for x in [spec.args, spec.defaults or []]] spec_dict = dict(zip_longest(*matched_args, fillvalue=NO_DEFAULT))