Skip to content

Commit ab8bf7f

Browse files
authored
Avoid index errors that cause Mypy to raise Internal Error (#1317)
1 parent e731b36 commit ab8bf7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy_django_plugin/transformers/orm_lookups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def typecheck_queryset_filter(ctx: MethodContext, django_context: DjangoContext)
1212
# Expected formal arguments for filter methods are `*args` and `**kwargs`. We'll only typecheck
1313
# `**kwargs`, which means that `arg_names[1]` is what we're interested in.
1414

15-
lookup_kwargs = ctx.arg_names[1]
16-
provided_lookup_types = ctx.arg_types[1]
15+
lookup_kwargs = ctx.arg_names[1] if len(ctx.arg_names) >= 2 else []
16+
provided_lookup_types = ctx.arg_types[1] if len(ctx.arg_types) >= 2 else []
1717

1818
assert isinstance(ctx.type, Instance)
1919

0 commit comments

Comments
 (0)