summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc/mock.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-08 01:23:17 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-08 01:23:17 +0900
commit5460ea103bd91ce910e50e11e05c1e5340c2a9e0 (patch)
tree2009eec87f4ef7442cd29158c000bd12be17b999 /sphinx/ext/autodoc/mock.py
parent5ba5602d7173d0da7adfb4f1e6279ff40c56ef47 (diff)
parentd9569a84a28b4720f9adf69ef9778961585ea19a (diff)
downloadsphinx-git-5460ea103bd91ce910e50e11e05c1e5340c2a9e0.tar.gz
Merge branch '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 e11f63559..513ce523f 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