Skip to content

Commit

Permalink
Merge pull request #7442 from tk0miya/7435_typehints_not_suppressed_f…
Browse files Browse the repository at this point in the history
…or_class

Fix #7435: autodoc_typehints doesn't suppress typehints for classes/methods
  • Loading branch information
tk0miya committed Apr 9, 2020
2 parents e9e4aa8 + a6dcbc7 commit aca3f82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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
* #7479: html theme: Do not include xmlns attribute with HTML 5 doctype
* #7426: html theme: Escape some links in HTML templates
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

0 comments on commit aca3f82

Please sign in to comment.