We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bb3a28 commit 53764f6Copy full SHA for 53764f6
mypy/types.py
@@ -1188,7 +1188,12 @@ def visit_type_var(self, t: TypeVarType) -> str:
1188
def visit_callable_type(self, t: CallableType) -> str:
1189
s = ''
1190
bare_asterisk = False
1191
- for i in range(len(t.arg_types)):
+ # The lengths of t.arg_types and t.arg_kinds must be equal in
1192
+ # order to be syntactically correct, but the interface extractor
1193
+ # will visit this node before it's checked. To prevent the interface
1194
+ # extractor from crashing, we just take the minimum of the two and
1195
+ # deal with the error later.
1196
+ for i in range(min(len(t.arg_types), len(t.arg_kinds))):
1197
if s != '':
1198
s += ', '
1199
if t.arg_kinds[i] == mypy.nodes.ARG_NAMED and not bare_asterisk:
0 commit comments