Fix py3.6b3 crashes with empty Callable annotation

This commit is contained in:
Takeshi KOMIYA 2016-11-03 10:00:35 +09:00
parent 4250052eda
commit f04adb1aa6

View File

@ -283,7 +283,7 @@ def format_annotation(annotation):
# arguments are in __parameters__.
params = None
if hasattr(annotation, '__args__'):
if len(annotation.__args__) <= 2:
if annotation.__args__ is None or len(annotation.__args__) <= 2:
params = annotation.__args__
else: # typing.Callable
args = ', '.join(format_annotation(a) for a in annotation.__args__[:-1])