diff --git a/CHANGES b/CHANGES index 7d5f801863a..37d8d6a633a 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,8 @@ Bugs fixed ---------- * #7428: py domain: a reference to class ``None`` emits a nitpicky warning +* #7435: autodoc: ``autodoc_typehints='description'`` doesn't suppress typehints + in signature for classes/methods Testing -------- diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index ad3e5f00add..f69e2b5f1f0 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1174,7 +1174,7 @@ def import_object(self) -> Any: return ret def format_args(self, **kwargs: Any) -> str: - if self.env.config.autodoc_typehints == 'none': + if self.env.config.autodoc_typehints in ('none', 'description'): kwargs.setdefault('show_annotation', False) # for classes, the relevant signature is the __init__ method's @@ -1430,7 +1430,7 @@ def import_object(self) -> Any: return ret def format_args(self, **kwargs: Any) -> str: - if self.env.config.autodoc_typehints == 'none': + if self.env.config.autodoc_typehints in ('none', 'description'): kwargs.setdefault('show_annotation', False) unwrapped = inspect.unwrap(self.object)