summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-11-05 01:54:23 +0900
committerGitHub <noreply@github.com>2020-11-05 01:54:23 +0900
commite1e0106aa461834e991b462e22f8edbe3bb8f850 (patch)
treebc2a5b6dd3a10b91fde9317dfd2c5924fec0b434 /sphinx
parent2da6de67219ed86acf0e0835b5330ee3269b5011 (diff)
parent0cf1632edf8e4f16796b4324be7de11b99853734 (diff)
downloadsphinx-git-4606_incorrect_location_of_docstring.tar.gz
Merge branch '3.x' into 4606_incorrect_location_of_docstring4606_incorrect_location_of_docstring
Diffstat (limited to 'sphinx')
-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 968b483b7..66bd2c69b 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1400,7 +1400,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__')