Skip to content

Comments incorrectly shown in pydoc output for argparse #134109

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

pydoc incorrectly shows some comments for argparse:

     |  format_help(self)
     |      # =======================
     |      # Help-formatting methods
     |      # =======================
     |
     |  start_section(self, heading)
     |      # ========================
     |      # Message building methods
     |      # ========================
     |

Comments immediately preceding the object's source code are used if the object has no docstring. But these comments do not describe the following methods. They are just section headers, separating groups of methods. They should be separated by an empty line from the following code.

Linked PRs

Activity

added
type-bugAn unexpected behavior, bug, or error
3.13bugs and security fixes
3.14bugs and security fixes
on May 16, 2025
added 2 commits that reference this issue on May 16, 2025

pythongh-134109: Fix showing comments in pydoc output for argparse

gh-134109: Fix showing comments in pydoc output for argparse (GH-134110)

71cf4dd
added a commit that references this issue on May 16, 2025

pythongh-134109: Fix showing comments in pydoc output for argparse (p…

7 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

Status

Doc issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Comments incorrectly shown in pydoc output for argparse · Issue #134109 · python/cpython

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant