[Python-checkins] python/dist/src/Lib inspect.py,1.44,1.45
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Fri, 27 Jun 2003 11:14:41 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv28310
Modified Files:
inspect.py
Log Message:
Fix for SF bug 620190: getargspec() doesn't work with methods.
Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** inspect.py 15 Jun 2003 22:33:28 -0000 1.44
--- inspect.py 27 Jun 2003 18:14:39 -0000 1.45
***************
*** 594,598 ****
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None."""
! if not iscode(co): raise TypeError, 'arg is not a code object'
code = co.co_code
--- 594,600 ----
a list of argument names (possibly containing nested lists), and
'varargs' and 'varkw' are the names of the * and ** arguments or None."""
!
! if not iscode(co):
! raise TypeError('arg is not a code object')
code = co.co_code
***************
*** 643,648 ****
'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 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
--- 645,655 ----
'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