mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
gh-130164: Fix inspect.Signature.bind() handling of positional-only args without defaults (GH-130192)
Follow-up to 9c15202
.
This commit is contained in:
parent
01ba7df499
commit
dab456dcef
3 changed files with 12 additions and 2 deletions
|
@ -3077,6 +3077,9 @@ class Signature:
|
|||
break
|
||||
elif param.name in kwargs:
|
||||
if param.kind == _POSITIONAL_ONLY:
|
||||
if param.default is _empty:
|
||||
msg = f'missing a required positional-only argument: {param.name!r}'
|
||||
raise TypeError(msg)
|
||||
# Raise a TypeError once we are sure there is no
|
||||
# **kwargs param later.
|
||||
pos_only_param_in_kwargs.append(param)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue