refactor: autodoc: Do not fill parent field when not global variable

This commit is contained in:
Takeshi KOMIYA 2020-12-21 01:20:58 +09:00
parent a7e10c1d36
commit d7c490fefc

View File

@ -1809,11 +1809,11 @@ class UninitializedGlobalVariableMixin(DataDocumenterMixinBase):
except ImportError as exc:
# annotation only instance variable (PEP-526)
try:
self.parent = importlib.import_module(self.modname)
annotations = get_type_hints(self.parent, None,
self.config.autodoc_type_aliases)
parent = importlib.import_module(self.modname)
annotations = get_type_hints(parent, None, self.config.autodoc_type_aliases)
if self.objpath[-1] in annotations:
self.object = UNINITIALIZED_ATTR
self.parent = parent
return True
except ImportError:
pass