summaryrefslogtreecommitdiff
path: root/sphinx/ext
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-11-05 02:21:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-11-05 02:21:47 +0900
commit8bf84167a30aa05886fcc1ed8895c8c20e939d89 (patch)
tree51252d17e9c5a344395d64fe4225759cb04f1f4c /sphinx/ext
parentb93aa3137af650ea01f3a68bb14e822bffe81309 (diff)
parentab707be1e1def8c904b5df0c5ddeaf2edacca0f6 (diff)
downloadsphinx-git-8bf84167a30aa05886fcc1ed8895c8c20e939d89.tar.gz
Merge branch '3.x'
Diffstat (limited to 'sphinx/ext')
-rw-r--r--sphinx/ext/autodoc/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index 4c28d7b3c..482b48d88 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1376,7 +1376,12 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
# This sequence is copied from inspect._signature_from_callable.
# ValueError means that no signature could be found, so we keep going.
- # First, let's see if it has an overloaded __call__ defined
+ # First, we check the obj has a __signature__ attribute
+ if (hasattr(self.object, '__signature__') and
+ isinstance(self.object.__signature__, Signature)):
+ return None, None, self.object.__signature__
+
+ # Next, let's see if it has an overloaded __call__ defined
# in its metaclass
call = get_user_defined_function_or_method(type(self.object), '__call__')