mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Fix py3.6b3 crashes with empty Callable annotation
This commit is contained in:
@@ -283,7 +283,7 @@ def format_annotation(annotation):
|
|||||||
# arguments are in __parameters__.
|
# arguments are in __parameters__.
|
||||||
params = None
|
params = None
|
||||||
if hasattr(annotation, '__args__'):
|
if hasattr(annotation, '__args__'):
|
||||||
if len(annotation.__args__) <= 2:
|
if annotation.__args__ is None or len(annotation.__args__) <= 2:
|
||||||
params = annotation.__args__
|
params = annotation.__args__
|
||||||
else: # typing.Callable
|
else: # typing.Callable
|
||||||
args = ', '.join(format_annotation(a) for a in annotation.__args__[:-1])
|
args = ', '.join(format_annotation(a) for a in annotation.__args__[:-1])
|
||||||
|
|||||||
Reference in New Issue
Block a user