You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[dima@bmg tmp]$ pydoc3.4 -k n688954789
Traceback (most recent call last):
File "/usr/bin/pydoc3.4", line 5, in <module>
pydoc.cli()
File "/usr/lib/python3.4/pydoc.py", line 2548, in cli
apropos(val)
File "/usr/lib/python3.4/pydoc.py", line 2080, in apropos
ModuleScanner().run(callback, key, onerror=onerror)
File "/usr/lib/python3.4/pydoc.py", line 2061, in run
desc = (module.__doc__or'').splitlines()[0]
IndexError: list index out of range
Clearly "".splitlines() is always empty; missing doc is not handled correctly.
Activity
dimaqq commentedon May 21, 2014
While trying to track down another bug, I disabled some packages:
[dima@bmg tmp]$ chmod a-x /usr/lib/python3.4/site-packages/speechd*
Then ran pydoc -k:
Clearly "".splitlines() is always empty; missing doc is not handled correctly.
terryjreedy commentedon May 23, 2014
Replacing 2061 with the following should work for all versions.
desc = module.__doc__.splitlines()[0] if module.__doc__ else ''
YuyangGuo commentedon Jun 7, 2014
Made change based on Terry J. Reedy's suggestion
benjaminp commentedon Jun 7, 2014
Thanks for the patch! It looks like the "synopsis" function also has this bug. Could you fix that, too?
berkerpeksag commentedon Jan 25, 2015
Here's a patch with tests.
serhiy-storchaka commentedon Feb 16, 2015
LGTM.
python-dev commentedon Feb 17, 2015
New changeset 9436f43b6df2 by Benjamin Peterson in branch '3.4':
fix pydoc.apropos and pydoc.synopsis on modules with empty docstrings (bpo-21548)
https://hg.python.org/cpython/rev/9436f43b6df2
New changeset 534b26837a13 by Benjamin Peterson in branch 'default':
merge 3.4 (bpo-21548)
https://hg.python.org/cpython/rev/534b26837a13
python-dev commentedon Feb 20, 2015
New changeset 43641e03692a by Berker Peksag in branch '2.7':
Issue bpo-21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty
https://hg.python.org/cpython/rev/43641e03692a