Merge pull request #7080 from tk0miya/fix_autodoc_typehints_crashed

autodoc: Fix crashed for objects having no module
This commit is contained in:
Takeshi KOMIYA
2020-02-01 11:05:20 +09:00
committed by GitHub

View File

@@ -57,7 +57,10 @@ def merge_typehints(app: Sphinx, domain: str, objtype: str, contentnode: Element
return
signature = cast(addnodes.desc_signature, contentnode.parent[0])
fullname = '.'.join([signature['module'], signature['fullname']])
if signature['module']:
fullname = '.'.join([signature['module'], signature['fullname']])
else:
fullname = signature['fullname']
annotations = app.env.temp_data.get('annotations', {})
if annotations.get(fullname, {}):
field_lists = [n for n in contentnode if isinstance(n, nodes.field_list)]