summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-20 05:13:38 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-20 05:13:38 (GMT)
commit536d2262f730dfd0d48ed541d834dd01f7d95562 (patch)
tree68b7d73547961857cda1063efece79a0dd6b4680 /Lib/pydoc.py
parent3069d50c18d776737dbcc9670ab2ac60679d09d1 (diff)
downloadcpython-536d2262f730dfd0d48ed541d834dd01f7d95562.zip
cpython-536d2262f730dfd0d48ed541d834dd01f7d95562.tar.gz
cpython-536d2262f730dfd0d48ed541d834dd01f7d95562.tar.bz2
After much thrashing, I believe this is a truly minimal patch to teach
pydoc how to do something sensible with 2.2 descriptors. To see the difference, browse __builtin__ via pydoc before and after the patch.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 4c7471a..b805031 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -115,9 +115,12 @@ def stripid(text):
return re.sub(pattern, '>', text)
return text
+def _is_some_method(object):
+ return inspect.ismethod(object) or inspect.ismethoddescriptor(object)
+
def allmethods(cl):
methods = {}
- for key, value in inspect.getmembers(cl, inspect.ismethod):
+ for key, value in inspect.getmembers(cl, _is_some_method):
methods[key] = 1
for base in cl.__bases__:
methods.update(allmethods(base)) # all your base are belong to us
@@ -656,7 +659,7 @@ 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):
+ if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object):
argspec = '(...)'
else:
args, varargs, varkw, defaults = inspect.getargspec(object)
@@ -913,7 +916,7 @@ class TextDoc(Doc):
cl.__dict__[realname] is object):
skipdocs = 1
title = self.bold(name) + ' = ' + realname
- if inspect.isbuiltin(object):
+ if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object):
argspec = '(...)'
else:
args, varargs, varkw, defaults = inspect.getargspec(object)