summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorJohannes Gijsbers <jlg@dds.nl>2004-08-30 14:13:04 (GMT)
committerJohannes Gijsbers <jlg@dds.nl>2004-08-30 14:13:04 (GMT)
commit4c11f6088af5c2b3b97ed4352df3e39c4c7c9732 (patch)
tree512ab204ea6370670e6c8acea6953ddc1cccf2fb /Lib/pydoc.py
parentd2a1aa4b1e6f8d152799737ae0b7c6cb1a213bbe (diff)
downloadcpython-4c11f6088af5c2b3b97ed4352df3e39c4c7c9732.zip
cpython-4c11f6088af5c2b3b97ed4352df3e39c4c7c9732.tar.gz
cpython-4c11f6088af5c2b3b97ed4352df3e39c4c7c9732.tar.bz2
Patch #934356: if a module defines __all__, believe that rather than using
heuristics for filtering out imported names.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 433bd28..daec8ab 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -592,7 +592,9 @@ class HTMLDoc(Doc):
classes, cdict = [], {}
for key, value in inspect.getmembers(object, inspect.isclass):
- if (inspect.getmodule(value) or object) is object:
+ # if __all__ exists, believe it. Otherwise use old heuristic.
+ if (all is not None or
+ (inspect.getmodule(value) or object) is object):
if visiblename(key, all):
classes.append((key, value))
cdict[key] = cdict[value] = '#' + key
@@ -606,7 +608,9 @@ class HTMLDoc(Doc):
cdict[key] = cdict[base] = modname + '.html#' + key
funcs, fdict = [], {}
for key, value in inspect.getmembers(object, inspect.isroutine):
- if inspect.isbuiltin(value) or inspect.getmodule(value) is object:
+ # if __all__ exists, believe it. Otherwise use old heuristic.
+ if (all is not None or
+ inspect.isbuiltin(value) or inspect.getmodule(value) is object):
if visiblename(key, all):
funcs.append((key, value))
fdict[key] = '#-' + key
@@ -1015,12 +1019,16 @@ class TextDoc(Doc):
classes = []
for key, value in inspect.getmembers(object, inspect.isclass):
- if (inspect.getmodule(value) or object) is object:
+ # if __all__ exists, believe it. Otherwise use old heuristic.
+ if (all is not None
+ or (inspect.getmodule(value) or object) is object):
if visiblename(key, all):
classes.append((key, value))
funcs = []
for key, value in inspect.getmembers(object, inspect.isroutine):
- if inspect.isbuiltin(value) or inspect.getmodule(value) is object:
+ # if __all__ exists, believe it. Otherwise use old heuristic.
+ if (all is not None or
+ inspect.isbuiltin(value) or inspect.getmodule(value) is object):
if visiblename(key, all):
funcs.append((key, value))
data = []