diff --git a/sphinx/ext/autodoc/directive.py b/sphinx/ext/autodoc/directive.py index dfac5e0e6..32adc342d 100644 --- a/sphinx/ext/autodoc/directive.py +++ b/sphinx/ext/autodoc/directive.py @@ -87,7 +87,8 @@ def process_documenter_options(documenter: "Type[Documenter]", config: Config, o negated = options.pop('no-' + name, True) is None if name in config.autodoc_default_options and not negated: if name in options: - # take value from options if present or extend it with autodoc_default_options if necessary + # take value from options if present or extend it + # with autodoc_default_options if necessary if name in AUTODOC_EXTENDABLE_OPTIONS: if options[name] is not None and options[name].startswith('+'): options[name] = ','.join([config.autodoc_default_options[name], diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py index 57401133f..bad8da61d 100644 --- a/tests/test_ext_autodoc.py +++ b/tests/test_ext_autodoc.py @@ -835,6 +835,10 @@ def test_autodoc_special_members(app): ' .. py:method:: Class.undocmeth()' ] + +@pytest.mark.sphinx('html', testroot='ext-autodoc') +def test_autodoc_special_members_extentiable(app): + # specific special methods from autodoc_default_options options = {"undoc-members": None} app.config.autodoc_default_options["special-members"] = "__special2__"