Bug report
Bug description:
The help builtin added by site, as implemented in pydoc.Helper, calls pydoc.getdoc to find documentation for an object or module, which is different than inspect.getdoc, in that it looks for comments too. This applies for modules as well, and the summary text after the hyphen in the header of the following form calls this:
package.submodule_name - blurb
The synopsis shown is gotten by pydoc.splitdoc on the output of pydoc.getdoc. An unintended side effect of this is that for a module foo without a docstring and with a file-level # type: ignore comment on the top, the following is printed as the first line of the help:
Same goes for comments like # flake8: noqa and # mypy: disable-error-code="<error-code>".
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
The
helpbuiltin added bysite, as implemented inpydoc.Helper, callspydoc.getdocto find documentation for an object or module, which is different thaninspect.getdoc, in that it looks for comments too. This applies for modules as well, and the summary text after the hyphen in the header of the following form calls this:The synopsis shown is gotten by
pydoc.splitdocon the output ofpydoc.getdoc. An unintended side effect of this is that for a modulefoowithout a docstring and with a file-level# type: ignorecomment on the top, the following is printed as the first line of the help:Same goes for comments like
# flake8: noqaand# mypy: disable-error-code="<error-code>".CPython versions tested on:
3.14
Operating systems tested on:
Windows