You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
autodata could not create document for instance variables with type annotation.
To Reproduce
# example.py
var: int
# index.rst
.. autodata:: example.var
It causes AttributeError
WARNING: autodoc: failed to import data 'var' from module 'example'; the following exception was raised:
Traceback (most recent call last):
File "/Users/tkomiya/work/sphinx/sphinx/util/inspect.py", line 343, in safe_getattr
return getattr(obj, name, *defargs)
AttributeError: module 'example' has no attribute 'var'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/tkomiya/work/sphinx/sphinx/ext/autodoc/importer.py", line 106, in import_object
obj = attrgetter(obj, mangled_name)
File "/Users/tkomiya/work/sphinx/sphinx/ext/autodoc/__init__.py", line 316, in get_attr
return autodoc_attrgetter(self.env.app, obj, name, *defargs)
File "/Users/tkomiya/work/sphinx/sphinx/ext/autodoc/__init__.py", line 2269, in autodoc_attrgetter
return safe_getattr(obj, name, *defargs)
File "/Users/tkomiya/work/sphinx/sphinx/util/inspect.py", line 359, in safe_getattr
raise AttributeError(name) from exc
AttributeError: var
Expected behavior
Document should be generated successfully like when I used automodule.
Your project
N/A
Screenshots
N/A
Environment info
OS: Mac
Python version: 3.9.0
Sphinx version: HEAD of 3.x
Sphinx extensions: sphinx.ext.autodoc
Extra tools: Nothing
Additional context
Nothing
The text was updated successfully, but these errors were encountered:
Describe the bug
autodata could not create document for instance variables with type annotation.
To Reproduce
It causes AttributeError
Expected behavior
Document should be generated successfully like when I used
automodule
.Your project
N/A
Screenshots
N/A
Environment info
Additional context
Nothing
The text was updated successfully, but these errors were encountered: