◐ Shell
clean mode source ↗

GH-83901: Improve Signature.bind error message for missing keyword-only params by RazerM · Pull Request #95347 · python/cpython

Expand Up @@ -3114,8 +3114,12 @@ def _bind(self, args, kwargs, *, partial=False): parameters_ex = (param,) break else: msg = 'missing a required argument: {arg!r}' msg = msg.format(arg=param.name) if param.kind == _KEYWORD_ONLY: argtype = ' keyword-only' else: argtype = '' msg = 'missing a required{argtype} argument: {arg!r}' msg = msg.format(arg=param.name, argtype=argtype) raise TypeError(msg) from None else: # We have a positional argument to process Expand Down