# Buggy code
def setup(app: Sphinx) -> Dict[str, Any]:
    app.add_autodocumenter(ModuleDocumenter)
    app.add_autodocumenter(ClassDocumenter)
    app.add_autodocumenter(ExceptionDocumenter)
    app.add_autodocumenter(DataDocumenter)
    app.add_autodocumenter(DataDeclarationDocumenter)
    app.add_autodocumenter(GenericAliasDocumenter)
    app.add_autodocumenter(TypeVarDocumenter)
    app.add_autodocumenter(FunctionDocumenter)
    app.add_autodocumenter(DecoratorDocumenter)
    app.add_autodocumenter(MethodDocumenter)
    app.add_autodocumenter(AttributeDocumenter)
    app.add_autodocumenter(PropertyDocumenter)
    app.add_autodocumenter(InstanceAttributeDocumenter)
    app.add_autodocumenter(SlotsAttributeDocumenter)

    app.add_config_value(
        "autoclass_content", "class", True, ENUM("both", "class", "init")
    )
    app.add_config_value(
        "autodoc_member_order",
        "alphabetical",
        True,
        ENUM("alphabetic", "alphabetical", "bysource", "groupwise"),
    )
    app.add_config_value("autodoc_default_options", {}, True)
    app.add_config_value("autodoc_docstring_signature", True, True)
    app.add_config_value("autodoc_mock_imports", [], True)
    app.add_config_value(
        "autodoc_typehints", "signature", True, ENUM("signature", "description", "none")
    )
    app.add_config_value("autodoc_type_aliases", {}, True)
    app.add_config_value("autodoc_warningiserror", True, True)
    app.add_config_value("autodoc_inherit_docstrings", True, True)
    app.add_event("autodoc-before-process-signature")
    app.add_event("autodoc-process-docstring")
    app.add_event("autodoc-process-signature")
    app.add_event("autodoc-skip-member")

    app.connect("config-inited", migrate_autodoc_member_order, priority=800)

    app.setup_extension("sphinx.ext.autodoc.type_comment")
    app.setup_extension("sphinx.ext.autodoc.typehints")

    return {"version": sphinx.__display_version__, "parallel_read_safe": True}


# Traceback (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

# Fixed code
def setup(app: Sphinx) -> Dict[str, Any]:
    app.add_autodocumenter(ModuleDocumenter)
    app.add_autodocumenter(ClassDocumenter)
    app.add_autodocumenter(ExceptionDocumenter)
    app.add_autodocumenter(DataDocumenter)
    app.add_autodocumenter(GenericAliasDocumenter)
    app.add_autodocumenter(TypeVarDocumenter)
    app.add_autodocumenter(FunctionDocumenter)
    app.add_autodocumenter(DecoratorDocumenter)
    app.add_autodocumenter(MethodDocumenter)
    app.add_autodocumenter(AttributeDocumenter)
    app.add_autodocumenter(PropertyDocumenter)
    app.add_autodocumenter(InstanceAttributeDocumenter)
    app.add_autodocumenter(SlotsAttributeDocumenter)

    app.add_config_value(
        "autoclass_content", "class", True, ENUM("both", "class", "init")
    )
    app.add_config_value(
        "autodoc_member_order",
        "alphabetical",
        True,
        ENUM("alphabetic", "alphabetical", "bysource", "groupwise"),
    )
    app.add_config_value("autodoc_default_options", {}, True)
    app.add_config_value("autodoc_docstring_signature", True, True)
    app.add_config_value("autodoc_mock_imports", [], True)
    app.add_config_value(
        "autodoc_typehints", "signature", True, ENUM("signature", "description", "none")
    )
    app.add_config_value("autodoc_type_aliases", {}, True)
    app.add_config_value("autodoc_warningiserror", True, True)
    app.add_config_value("autodoc_inherit_docstrings", True, True)
    app.add_event("autodoc-before-process-signature")
    app.add_event("autodoc-process-docstring")
    app.add_event("autodoc-process-signature")
    app.add_event("autodoc-skip-member")

    app.connect("config-inited", migrate_autodoc_member_order, priority=800)

    app.setup_extension("sphinx.ext.autodoc.type_comment")
    app.setup_extension("sphinx.ext.autodoc.typehints")

    return {"version": sphinx.__display_version__, "parallel_read_safe": True}