mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.14] gh-125028: Prohibit placeholders in partial keywords (GH-126062) (GH-133645)
(cherry picked from commit afed5f8835
)
Co-authored-by: dgpb <3577712+dg-pb@users.noreply.github.com>
This commit is contained in:
parent
c6a56e3d91
commit
effe8d4971
5 changed files with 37 additions and 2 deletions
|
@ -323,6 +323,9 @@ def _partial_new(cls, func, /, *args, **keywords):
|
|||
"or a descriptor")
|
||||
if args and args[-1] is Placeholder:
|
||||
raise TypeError("trailing Placeholders are not allowed")
|
||||
for value in keywords.values():
|
||||
if value is Placeholder:
|
||||
raise TypeError("Placeholder cannot be passed as a keyword argument")
|
||||
if isinstance(func, base_cls):
|
||||
pto_phcount = func._phcount
|
||||
tot_args = func.args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue