diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-02-17 00:45:01 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-02-17 00:45:01 (GMT) |
commit | 54237f9feaefd209c2aaa5b4003810e69f6714f3 (patch) | |
tree | f6dc68eea09d8fd6f6115259723914296aa01d6c /Lib/pydoc.py | |
parent | 3584056ca58957a6adca060419e48a9488852550 (diff) | |
download | cpython-54237f9feaefd209c2aaa5b4003810e69f6714f3.zip cpython-54237f9feaefd209c2aaa5b4003810e69f6714f3.tar.gz cpython-54237f9feaefd209c2aaa5b4003810e69f6714f3.tar.bz2 |
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-x | Lib/pydoc.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index d53a1b4..d37ebf1 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: |