Skip to content

Commit 53764f6

Browse files
committed
Fix bug in string output for strings
1 parent 4bb3a28 commit 53764f6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypy/types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,12 @@ def visit_type_var(self, t: TypeVarType) -> str:
11881188
def visit_callable_type(self, t: CallableType) -> str:
11891189
s = ''
11901190
bare_asterisk = False
1191-
for i in range(len(t.arg_types)):
1191+
# 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))):
11921197
if s != '':
11931198
s += ', '
11941199
if t.arg_kinds[i] == mypy.nodes.ARG_NAMED and not bare_asterisk:

0 commit comments

Comments
 (0)