-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Milestone
Description
Describe the bug
Default values for class methods are rendered as their __repr__, even with autodoc_preserve_defaults = True in conf.py.
How to Reproduce
Extract the attached example and run make html. Note that the default value for the argument of the regular and static methods render correctly as SOME_DEFAULT, but the default value for the class method renders as its repr.
Expected behavior
All three methods' argument's default values should render as SOME_DEFAULT
Your project
https://github.com/sphinx-doc/sphinx/files/8620112/classmethod_defaults_mre.zip
Screenshots
Screenshot of the rendered attached example demonstrating incorrect rendering:
OS
Arch Linux
Python version
3.10.0
Sphinx version
Tested on 4.5 and current 5.x branch (commit 335bf51)
Sphinx extensions
sphinx.ext.autodoc
Extra tools
No response
Additional context
No response
