mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: autodoc: Do not fill parent field when not global variable
This commit is contained in:
parent
a7e10c1d36
commit
d7c490fefc
@ -1809,11 +1809,11 @@ class UninitializedGlobalVariableMixin(DataDocumenterMixinBase):
|
|||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
# annotation only instance variable (PEP-526)
|
# annotation only instance variable (PEP-526)
|
||||||
try:
|
try:
|
||||||
self.parent = importlib.import_module(self.modname)
|
parent = importlib.import_module(self.modname)
|
||||||
annotations = get_type_hints(self.parent, None,
|
annotations = get_type_hints(parent, None, self.config.autodoc_type_aliases)
|
||||||
self.config.autodoc_type_aliases)
|
|
||||||
if self.objpath[-1] in annotations:
|
if self.objpath[-1] in annotations:
|
||||||
self.object = UNINITIALIZED_ATTR
|
self.object = UNINITIALIZED_ATTR
|
||||||
|
self.parent = parent
|
||||||
return True
|
return True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user