@@ -2786,9 +2786,9 @@ def plausible_overload_call_targets(
27862786 ) -> list [CallableType ]:
27872787 """Returns all overload call targets that having matching argument counts.
27882788
2789- If the given args contains a star-arg (*arg or **kwarg argument), this method
2790- will ensure all star-arg overloads appear at the start of the list, instead
2791- of their usual location.
2789+ If the given args contains a star-arg (*arg or **kwarg argument, including
2790+ ParamSpec), this method will ensure all star-arg overloads appear at the start
2791+ of the list, instead of their usual location.
27922792
27932793 The only exception is if the starred argument is something like a Tuple or a
27942794 NamedTuple, which has a definitive "shape". If so, we don't move the corresponding
@@ -2817,12 +2817,12 @@ def has_shape(typ: Type) -> bool:
28172817 arg_kinds , arg_names , typ .arg_kinds , typ .arg_names , lambda i : arg_types [i ]
28182818 )
28192819 with self .msg .filter_errors ():
2820- if typ .is_generic () and typ . param_spec () is not None :
2821- typ , formal_to_actual = self . adjust_generic_callable_params_mapping (
2822- typ , args , arg_kinds , arg_names , formal_to_actual , context
2823- )
2824-
2825- if self .check_argument_count (
2820+ if typ .param_spec () is not None :
2821+ # ParamSpec can be expanded in a lot of different ways. We may try
2822+ # to expand it here instead, but picking an impossible overload
2823+ # is safe: it will be filtered out later.
2824+ star_matches . append ( typ )
2825+ elif self .check_argument_count (
28262826 typ , arg_types , arg_kinds , arg_names , formal_to_actual , None
28272827 ):
28282828 if args_have_var_arg and typ .is_var_arg :
0 commit comments