summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-09-29 14:15:33 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-09-29 14:15:33 +0900
commit0417a084dbe7c56ca8d6c4a4d50c7822f996c50a (patch)
tree727eab08696d202b615f2c74d4f3a75331624722 /sphinx/ext/autodoc.py
parentd6ae5144259901a2720d4a8f04b7bd0f230dfe34 (diff)
parent9118fa38a1492d6444829be07e5ec4aee0c91e35 (diff)
downloadsphinx-git-0417a084dbe7c56ca8d6c4a4d50c7822f996c50a.tar.gz
Merge branch 'stable'
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 769f8cc9a..bfbbbea72 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -268,6 +268,8 @@ def format_annotation(annotation):
Displaying complex types from ``typing`` relies on its private API.
"""
+ if typing and isinstance(annotation, typing.TypeVar):
+ return annotation.__name__
if not isinstance(annotation, type):
return repr(annotation)
@@ -277,9 +279,7 @@ def format_annotation(annotation):
if annotation.__module__ == 'builtins':
return annotation.__qualname__
elif typing:
- if isinstance(annotation, typing.TypeVar):
- return annotation.__name__
- elif hasattr(typing, 'GenericMeta') and \
+ if hasattr(typing, 'GenericMeta') and \
isinstance(annotation, typing.GenericMeta):
# In Python 3.5.2+, all arguments are stored in __args__,
# whereas __parameters__ only contains generic parameters.