summaryrefslogtreecommitdiff
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-02-16 19:45:01 -0500
committerBenjamin Peterson <benjamin@python.org>2015-02-16 19:45:01 -0500
commit54237f9feaefd209c2aaa5b4003810e69f6714f3 (patch)
treef6dc68eea09d8fd6f6115259723914296aa01d6c /Lib/pydoc.py
parent3584056ca58957a6adca060419e48a9488852550 (diff)
downloadcpython-git-54237f9feaefd209c2aaa5b4003810e69f6714f3.tar.gz
fix pydoc.apropos and pydoc.synopsis on modules with empty docstrings (#21548)
Patch by Yuyang Guo and Berker Peksag.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index d53a1b4b7e..d37ebf12db 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -270,7 +270,7 @@ def synopsis(filename, cache={}):
except:
return None
del sys.modules['__temp__']
- result = (module.__doc__ or '').splitlines()[0]
+ result = module.__doc__.splitlines()[0] if module.__doc__ else None
# Cache the result.
cache[filename] = (mtime, result)
return result
@@ -2075,7 +2075,7 @@ class ModuleScanner:
if onerror:
onerror(modname)
continue
- desc = (module.__doc__ or '').splitlines()[0]
+ desc = module.__doc__.splitlines()[0] if module.__doc__ else ''
path = getattr(module,'__file__',None)
name = modname + ' - ' + desc
if name.lower().find(key) >= 0: