@@ -346,7 +346,7 @@ def partial_call_callback(ctx: mypy.plugin.MethodContext) -> Type:
346346 actual_arg_kinds .append (ctx .arg_kinds [i ][j ])
347347 actual_arg_names .append (ctx .arg_names [i ][j ])
348348
349- result , inf = ctx .api .expr_checker .check_call (
349+ result , _ = ctx .api .expr_checker .check_call (
350350 callee = partial_type ,
351351 args = actual_args ,
352352 arg_kinds = actual_arg_kinds ,
@@ -359,27 +359,22 @@ def partial_call_callback(ctx: mypy.plugin.MethodContext) -> Type:
359359 args_bound = "__mypy_partial_paramspec_args_bound" in extra_attrs .immutable
360360 kwargs_bound = "__mypy_partial_paramspec_kwargs_bound" in extra_attrs .immutable
361361
362- # ensure *args: P.args
363- args_passed = any (
364- isinstance (arg , NameExpr )
362+ passed_paramspec_parts = [
363+ arg .node .type
364+ for arg in actual_args
365+ if isinstance (arg , NameExpr )
365366 and isinstance (arg .node , Var )
366367 and isinstance (arg .node .type , ParamSpecType )
367- and arg . node . type . flavor == ParamSpecFlavor . ARGS
368- for arg in actual_args
369- )
368+ ]
369+ # ensure *args: P.args
370+ args_passed = any ( part . flavor == ParamSpecFlavor . ARGS for part in passed_paramspec_parts )
370371 if not args_bound and not args_passed :
371372 ctx .api .expr_checker .msg .too_few_arguments (partial_type , ctx .context , actual_arg_names )
372373 elif args_bound and args_passed :
373374 ctx .api .expr_checker .msg .too_many_arguments (partial_type , ctx .context )
374375
375376 # ensure **kwargs: P.kwargs
376- kwargs_passed = any (
377- isinstance (arg , NameExpr )
378- and isinstance (arg .node , Var )
379- and isinstance (arg .node .type , ParamSpecType )
380- and arg .node .type .flavor == ParamSpecFlavor .KWARGS
381- for arg in actual_args
382- )
377+ kwargs_passed = any (part .flavor == ParamSpecFlavor .KWARGS for part in passed_paramspec_parts )
383378 if not kwargs_bound and not kwargs_passed :
384379 ctx .api .expr_checker .msg .too_few_arguments (partial_type , ctx .context , actual_arg_names )
385380
0 commit comments