]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix for SF bug 620190: getargspec() doesn't understand methods.
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 27 Jun 2003 18:16:21 +0000 (18:16 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 27 Jun 2003 18:16:21 +0000 (18:16 +0000)
Lib/inspect.py

index 0248dd59c201e6af9f82b75229f389f2e59c1916..02c710125c9586e387168243933dc490d95538bd 100644 (file)
@@ -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