Skip to content

GH-103219: Fix optional args incorrectly being processed as required args #123931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

savannahostrowski
Copy link
Member

@savannahostrowski savannahostrowski commented Sep 11, 2024

This PR addresses a pretty old bug where optional args were incorrectly marked as required and adds a corresponding test case. We now more thoroughly check to see that an arg is 1) required, 2) has no default value, and 3) nargs is not set to * or ? before adding it to the list of required args.

It looks like this bug at least dates back to 3.9, but since those releases are just for security fixes at this point, I've marked this for backport to 3.12 and 3.13.

@savannahostrowski savannahostrowski added tests Tests in the Lib/test dir stdlib Python modules in the Lib dir needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Sep 11, 2024
@savannahostrowski savannahostrowski changed the title GH-103219: Update handling of nargs=* being incorrectly required GH-103219: Fix optional args incorrectly being processed as required args Sep 11, 2024
@serhiy-storchaka
Copy link
Member

See also #124306 which fixes the bug in other way. It actually fixes several bugs, so I think that it is more correct way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes stdlib Python modules in the Lib dir tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants