diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 3c1f23bf1f0..855b86d8764 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -578,9 +578,9 @@ def is_filtered_inherited_member(name: str) -> bool: isprivate = membername.startswith('_') keep = False - if getattr(member, '__sphinx_mock__', False): + if safe_getattr(member, '__sphinx_mock__', False): # mocked module or object - keep = False + pass elif want_all and membername.startswith('__') and \ membername.endswith('__') and len(membername) > 4: # special __methods__