Since inspect.isfunction(obj) is a precondition for calling

inspect.getargspec(obj), test isfunction() directly in pydoc.py instead
of trying to indirectly deduce isfunction() in pydoc by virtue of
failing a combination of other tests.  This shouldn't have any visible
effect, except perhaps to squash a TypeError death if there was some path
thru this code that was inferring isfunction() by mistake.
This commit is contained in:
Tim Peters 2001-09-20 06:08:24 +00:00
parent f1d90b965e
commit 4bcfa317ee
1 changed files with 6 additions and 6 deletions

View File

@ -659,15 +659,15 @@ TT { font-family: lucidatypewriter, lucida console, courier }
reallink = realname reallink = realname
title = '<a name="%s"><strong>%s</strong></a> = %s' % ( title = '<a name="%s"><strong>%s</strong></a> = %s' % (
anchor, name, reallink) anchor, name, reallink)
if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object): if inspect.isfunction(object):
argspec = '(...)'
else:
args, varargs, varkw, defaults = inspect.getargspec(object) args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec( argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue) args, varargs, varkw, defaults, formatvalue=self.formatvalue)
if realname == '<lambda>': if realname == '<lambda>':
decl = '<em>lambda</em>' decl = '<em>lambda</em>'
argspec = argspec[1:-1] # remove parentheses argspec = argspec[1:-1] # remove parentheses
else:
argspec = '(...)'
decl = title + argspec + (note and self.small(self.grey( decl = title + argspec + (note and self.small(self.grey(
'<font face="helvetica, arial">%s</font>' % note))) '<font face="helvetica, arial">%s</font>' % note)))
@ -916,15 +916,15 @@ class TextDoc(Doc):
cl.__dict__[realname] is object): cl.__dict__[realname] is object):
skipdocs = 1 skipdocs = 1
title = self.bold(name) + ' = ' + realname title = self.bold(name) + ' = ' + realname
if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object): if inspect.isfunction(object):
argspec = '(...)'
else:
args, varargs, varkw, defaults = inspect.getargspec(object) args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec( argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue) args, varargs, varkw, defaults, formatvalue=self.formatvalue)
if realname == '<lambda>': if realname == '<lambda>':
title = 'lambda' title = 'lambda'
argspec = argspec[1:-1] # remove parentheses argspec = argspec[1:-1] # remove parentheses
else:
argspec = '(...)'
decl = title + argspec + note decl = title + argspec + note
if skipdocs: if skipdocs: