Skip to content

gh-64502: Fix Argument Clinic support of optional groups with defaults - #155191

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:clinic-groups-defaults
Aug 5, 2026
Merged

gh-64502: Fix Argument Clinic support of optional groups with defaults#155191
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:clinic-groups-defaults

Conversation

@serhiy-storchaka

@serhiy-storchakaserhiy-storchaka commented Aug 4, 2026

Copy link
Copy Markdown
Member

Parameters with a default value which are not in any group were always required in the generated argument parsing code, although they were rendered as optional in the signature.

They can now be omitted: [y, x,] n=1023 accepts 0, 1, 2 or 3 arguments.

Ambiguous combinations of optional groups and parameters with a default value are now rejected.

…efaults
Parameters with a default value which are not in any group were always
required in the generated argument parsing code, although they were
rendered as optional in the signature. They can now be omitted, and
ambiguous combinations of optional groups and parameters with a default
value are rejected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…linic.c
The added test functions made the preprocessed method table exceed the
default limit of the C globals checker.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
serhiy-storchakaand others added 2 commits August 5, 2026 08:32
Use a single dict which maps the number of arguments to the subset of
parameters which accepts it, instead of a list of subsets and a set of
already used counts.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@serhiy-storchaka
serhiy-storchaka merged commit caac927 into python:mainAug 5, 2026
62 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the clinic-groups-defaults branch August 5, 2026 06:21
@serhiy-storchakaserhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 5, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker caac9278306d3cb96b22f51f5003e20b7a6aa18c 3.14

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker caac9278306d3cb96b22f51f5003e20b7a6aa18c 3.13

@bedevere-app

Copy link
Copy Markdown

GH-155209 is a backport of this pull request to the 3.15 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 5, 2026
@bedevere-app

Copy link
Copy Markdown

GH-155216 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Aug 5, 2026
@bedevere-app

Copy link
Copy Markdown

GH-155217 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Aug 5, 2026
serhiy-storchaka added a commit that referenced this pull request Aug 5, 2026
…defaults (GH-155191) (GH-155217)
Parameters with a default value which are not in any group were always
required in the generated argument parsing code, although they were
rendered as optional in the signature. They can now be omitted, and
ambiguous combinations of optional groups and parameters with a default
value are rejected.
(cherry picked from commit caac927)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Aug 5, 2026
…defaults (GH-155191) (GH-155216)
Parameters with a default value which are not in any group were always
required in the generated argument parsing code, although they were
rendered as optional in the signature. They can now be omitted, and
ambiguous combinations of optional groups and parameters with a default
value are rejected.
(cherry picked from commit caac927)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@serhiy-storchaka