From: Jeremy Hylton Date: Fri, 27 Jun 2003 18:16:21 +0000 (+0000) Subject: Fix for SF bug 620190: getargspec() doesn't understand methods. X-Git-Tag: 2.2~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78347b509f7c503432762bdbc0cef02041419bcf;p=thirdparty%2FPython%2Fcpython.git Fix for SF bug 620190: getargspec() doesn't understand methods. --- diff --git a/Lib/inspect.py b/Lib/inspect.py index 0248dd59c201..02c710125c95 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -619,6 +619,8 @@ def getargspec(func): 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments.""" + if ismethod(func): + func = func.im_func if not isfunction(func): raise TypeError, 'arg is not a Python function' args, varargs, varkw = getargs(func.func_code) return args, varargs, varkw, func.func_defaults