sphinx-doc / sphinx-doc/sphinx

autodoc loses the first staticmethod parameter if the method is name mangled

Open
#9,342 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:autodoc type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Static methods lose their first parameter in signature if they are also name mangled, i.e. __begins_like_this().
Similar to #4769 and #5032.

To Reproduce
Please download my sample project and build the documentation

C:\> cd sphinx_private_static\docs
C:\sphinx_private_static\docs> sphinx-build Source Build

Expected behavior
Parameter is not dropped from signature

Your project
sphinx_private_static.zip

Environment info

  • OS: Windows 10 Version 1909
  • Python version: 3.8
  • Sphinx version: 4.0.2
  • Sphinx extensions: sphinx.ext.autodoc
  • Extra tools: Browser, PyCharm CE with venv (didn't inherit site-packages)

@tk0miya This is my follow-up as requested in #9318. Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied sphinx_private_static sample project and build its documentation using sphinx-build Source Build from the docs directory. Trace the issue through the sphinx.ext.autodoc entry point and verify that the generated signature for a name-mangled static method retains its first parameter.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.