[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:
Miss Islington (bot) 2025-05-08 10:26:14 +02:00 committed by GitHub
parent c6a56e3d91
commit effe8d4971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 2 deletions

View file

@ -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