@@ -3171,7 +3171,7 @@ def _bind(self, args, kwargs, *, partial=False):
31713171 break
31723172 elif param .name in kwargs :
31733173 if param .kind == _POSITIONAL_ONLY :
3174- if param .default is _empty :
3174+ if not partial and param .default is _empty :
31753175 msg = f'missing a required positional-only argument: { param .name !r} '
31763176 raise TypeError (msg )
31773177 # Raise a TypeError once we are sure there is no
@@ -3234,26 +3234,31 @@ def _bind(self, args, kwargs, *, partial=False):
32343234 # keyword arguments
32353235 kwargs_param = None
32363236 for param in itertools .chain (parameters_ex , parameters ):
3237- if param .kind == _VAR_KEYWORD :
3237+ kind = param .kind
3238+ if kind == _VAR_KEYWORD :
32383239 # Memorize that we have a '**kwargs'-like parameter
32393240 kwargs_param = param
32403241 continue
32413242
3242- if param . kind == _VAR_POSITIONAL :
3243+ if kind == _VAR_POSITIONAL :
32433244 # Named arguments don't refer to '*args'-like parameters.
32443245 # We only arrive here if the positional arguments ended
32453246 # before reaching the last parameter before *args.
32463247 continue
32473248
32483249 param_name = param .name
3250+ if kind == _POSITIONAL_ONLY and param_name in kwargs :
3251+ pos_only_param_in_kwargs .append (param )
3252+ continue
3253+
32493254 try :
32503255 arg_val = kwargs .pop (param_name )
32513256 except KeyError :
32523257 # We have no value for this parameter. It's fine though,
32533258 # if it has a default value, or it is an '*args'-like
32543259 # parameter, left alone by the processing of positional
32553260 # arguments.
3256- if (not partial and param . kind != _VAR_POSITIONAL and
3261+ if (not partial and kind != _VAR_POSITIONAL and
32573262 param .default is _empty ):
32583263 raise TypeError ('missing a required argument: {arg!r}' . \
32593264 format (arg = param_name )) from None
0 commit comments