summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2016-04-09 17:24:34 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2016-11-02 21:43:33 +0200
commita1f6baaa8183e32e39dedede577955a2765f5d96 (patch)
treeee850c3d0fb8fefa6ac4fc7a1d4a97d90138f452 /sphinx/ext/autodoc.py
parent0f35b9450010cd443205ed475c896b8a45697ef1 (diff)
downloadsphinx-git-a1f6baaa8183e32e39dedede577955a2765f5d96.tar.gz
Fix annotations formatting for plain typing.Callable
The typing.Callable class may be used without generic arguments, in which case it is equivalent to collections.abc.Callable.
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 148c09811..d3621e6db 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -313,7 +313,7 @@ def format_annotation(annotation):
return '%s[%s]' % (qualified_name, param_str)
elif hasattr(typing, 'CallableMeta') and \
isinstance(annotation, typing.CallableMeta) and \
- hasattr(annotation, '__args__') and \
+ getattr(annotation, '__args__', None) is not None and \
hasattr(annotation, '__result__'):
args = annotation.__args__
if args is Ellipsis: