-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-89398: Fix argparse namespace overridden by subparsers default #30219
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
base: main
Are you sure you want to change the base?
gh-89398: Fix argparse namespace overridden by subparsers default #30219
Conversation
Lib/argparse.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you convert it into a list if the caller (__eq__) turns it into a dict again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The __repr__ implementation of the parent class _AttributeHolder also calls this. But this change can be considered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, I should have checked that. Better to just leave it as is then.
MaxwellDupre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test module shows no issues in 1674 tests.
2281bfe to
4c5cc3c
Compare
4c5cc3c to
95cb850
Compare
5db6000 to
8c771dd
Compare
Signed-off-by: Frost Ming <[email protected]>
8c771dd to
96ace73
Compare
This PR is to fix gh-89398 with another approach than #29574.
The default values are stored in a dunder attribute in
Namespaceto ensure they don't override the given values.