autodoc_preserve_defaults
doesn't work on class methods
#10421
Labels
Milestone
autodoc_preserve_defaults
doesn't work on class methods
#10421
Describe the bug
Default values for class methods are rendered as their
__repr__
, even withautodoc_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 asSOME_DEFAULT
, but the default value for the class method renders as its repr.classmethod_defaults_mre.zip
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
The text was updated successfully, but these errors were encountered: