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
gh-89398: Fix argparse namespace overridden by subparsers default #30219
base: main
Are you sure you want to change the base?
gh-89398: Fix argparse namespace overridden by subparsers default #30219
Conversation
| def _get_kwargs(self): | ||
| kwargs = self.__defaults__ | self.__dict__ | ||
| kwargs.pop('__defaults__', None) | ||
| return list(kwargs.items()) |
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.
2281bfe
to
4c5cc3c
Compare
4c5cc3c
to
95cb850
Compare

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

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.https://bugs.python.org/issue45235