Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #7435: autodoc_typehints doesn't suppress typehints for classes/methods #7442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -22,6 +22,8 @@ Bugs fixed
* #7418: std domain: duplication warning for glossary terms is case insensitive
* #7438: C++, fix merging overloaded functions in parallel builds.
* #7422: autodoc: fails with ValueError when using autodoc_mock_imports
* #7435: autodoc: ``autodoc_typehints='description'`` doesn't suppress typehints
in signature for classes/methods
* #7423: crashed when giving a non-string object to logger

Testing
Expand Down
4 changes: 2 additions & 2 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down