diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-02-20 10:10:33 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-02-20 10:10:33 (GMT) |
commit | dc9d41d71820b255ba21683578aac7c9129cf0ce (patch) | |
tree | 7eb0ad04ef244ab67fd05bd1e96bd72c4b2c18ac /Lib/pydoc.py | |
parent | bbdad5442b874f497d0c8b5d9612dc9d1c3594de (diff) | |
download | cpython-dc9d41d71820b255ba21683578aac7c9129cf0ce.zip cpython-dc9d41d71820b255ba21683578aac7c9129cf0ce.tar.gz cpython-dc9d41d71820b255ba21683578aac7c9129cf0ce.tar.bz2 |
Issue #21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty
docstrings.
Initial patch by Yuyang Guo.
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 0647d1e..b56d385 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -255,7 +255,7 @@ def synopsis(filename, cache={}): if info and 'b' in info[2]: # binary modules have to be imported try: module = imp.load_module('__temp__', file, filename, info[1:]) except: return None - result = (module.__doc__ or '').splitlines()[0] + result = module.__doc__.splitlines()[0] if module.__doc__ else None del sys.modules['__temp__'] else: # text modules can be directly examined result = source_synopsis(file) @@ -2020,7 +2020,7 @@ class ModuleScanner: path = None else: module = loader.load_module(modname) - desc = (module.__doc__ or '').splitlines()[0] + desc = module.__doc__.splitlines()[0] if module.__doc__ else '' path = getattr(module,'__file__',None) if find(lower(modname + ' - ' + desc), key) >= 0: callback(path, modname, desc) |