summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc/mock.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-08 01:18:53 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-08 01:18:53 +0900
commitd9569a84a28b4720f9adf69ef9778961585ea19a (patch)
tree5a2abdd7e4643e3a465ae9817aa33df6667dbe26 /sphinx/ext/autodoc/mock.py
parentca9342cc440bd3842dff26841d146beaf7b8c4b3 (diff)
parent458ccbea0b8026a00113d7e8255ec4e028d4cd08 (diff)
downloadsphinx-git-d9569a84a28b4720f9adf69ef9778961585ea19a.tar.gz
Merge branch '3.4.x' into 3.x
Diffstat (limited to 'sphinx/ext/autodoc/mock.py')
-rw-r--r--sphinx/ext/autodoc/mock.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc/mock.py b/sphinx/ext/autodoc/mock.py
index 381848fc1..3d4f76410 100644
--- a/sphinx/ext/autodoc/mock.py
+++ b/sphinx/ext/autodoc/mock.py
@@ -153,7 +153,10 @@ def mock(modnames: List[str]) -> Generator[None, None, None]:
def ismock(subject: Any) -> bool:
"""Check if the object is mocked."""
# check the object has '__sphinx_mock__' attribute
- if not hasattr(subject, '__sphinx_mock__'):
+ try:
+ if safe_getattr(subject, '__sphinx_mock__', None) is None:
+ return False
+ except AttributeError:
return False
# check the object is mocked module