From 78347b509f7c503432762bdbc0cef02041419bcf Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Fri, 27 Jun 2003 18:16:21 +0000 Subject: [PATCH] Fix for SF bug 620190: getargspec() doesn't understand methods. --- Lib/inspect.py | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.47.3