summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-20 06:08:24 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-20 06:08:24 (GMT)
commit4bcfa317eec0eb479586be10f326aefb994ccf28 (patch)
tree043bbfda6c4059ed0d2f2330d35022ed38b1dbdf /Lib
parentf1d90b965e50c17d09535c1f740942dde3d8a294 (diff)
downloadcpython-4bcfa317eec0eb479586be10f326aefb994ccf28.zip
cpython-4bcfa317eec0eb479586be10f326aefb994ccf28.tar.gz
cpython-4bcfa317eec0eb479586be10f326aefb994ccf28.tar.bz2
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.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pydoc.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index b805031..ecc39c5 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -659,15 +659,15 @@ TT { font-family: lucidatypewriter, lucida console, courier }
reallink = realname
title = '<a name="%s"><strong>%s</strong></a> = %s' % (
anchor, name, reallink)
- if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object):
- argspec = '(...)'
- else:
+ if inspect.isfunction(object):
args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue)
if realname == '<lambda>':
decl = '<em>lambda</em>'
argspec = argspec[1:-1] # remove parentheses
+ else:
+ argspec = '(...)'
decl = title + argspec + (note and self.small(self.grey(
'<font face="helvetica, arial">%s</font>' % note)))
@@ -916,15 +916,15 @@ class TextDoc(Doc):
cl.__dict__[realname] is object):
skipdocs = 1
title = self.bold(name) + ' = ' + realname
- if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object):
- argspec = '(...)'
- else:
+ if inspect.isfunction(object):
args, varargs, varkw, defaults = inspect.getargspec(object)
argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue)
if realname == '<lambda>':
title = 'lambda'
argspec = argspec[1:-1] # remove parentheses
+ else:
+ argspec = '(...)'
decl = title + argspec + note
if skipdocs: