Merge pull request #7336 from tk0miya/7329_typehints_description_for_class

Fix #7329: autodoc: typehints doc is wrongly generated
This commit is contained in:
Takeshi KOMIYA 2020-03-21 17:30:31 +09:00 committed by GitHub
commit 54dada2eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -124,6 +124,8 @@ Bugs fixed
generated automatically in signatures.
* #5637: autodoc: Incorrect handling of nested class names on show-inheritance
* #7267: autodoc: error message for invalid directive options has wrong location
* #7329: autodoc: info-field-list is wrongly generated from type hints into the
class description even if ``autoclass_content='class'`` set
* #5637: inheritance_diagram: Incorrect handling of nested class names
* #7139: ``code-block:: guess`` does not work
* #7325: html: source_suffix containing dot leads to wrong source link

View File

@ -43,6 +43,8 @@ def merge_typehints(app: Sphinx, domain: str, objtype: str, contentnode: Element
return
if app.config.autodoc_typehints != 'description':
return
if objtype == 'class' and app.config.autoclass_content not in ('init', 'both'):
return
signature = cast(addnodes.desc_signature, contentnode.parent[0])
if signature['module']: