-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
bpo-45235: Revert an argparse bugfix that caused a regression #29525
bpo-45235: Revert an argparse bugfix that caused a regression #29525
Conversation
Update to 15 March
…faults (pythonGH-28420) (pythonGH-28443)" This reverts commit a18d522.
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.
We could remove this testing blindspot if we also added a test for the case that broke with GH-28420.
def test_set_defaults_on_subparser_with_namespace(self): | ||
parser = argparse.ArgumentParser() | ||
xparser = parser.add_subparsers().add_parser('X') | ||
xparser.set_defaults(foo=1) | ||
self.assertEqual(NS(foo=2), parser.parse_args(['X'], NS(foo=2))) | ||
|
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.
How about we keep this test and mark is as xfail
until we bring back a better patch for the original issue?
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.
I think it would be better to leave it out. Also, any future changes will likely only go onto the main branch, so there is no value in leaving disabled tests in older versions. I would like to just do a clean revert. The open BPO issue will serve as the marker for future work to be done.
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
GH-29530 is a backport of this pull request to the 3.10 branch. |
…GH-29525) * Revert "bpo-45235: Fix argparse overrides namespace with subparser defaults (pythonGH-28420) (pythonGH-28443)" This reverts commit a18d522. (cherry picked from commit 807f839) Co-authored-by: Raymond Hettinger <[email protected]>
…GH-29525) * Revert "bpo-45235: Fix argparse overrides namespace with subparser defaults (pythonGH-28420) (pythonGH-28443)" This reverts commit a18d522. (cherry picked from commit 807f839) Co-authored-by: Raymond Hettinger <[email protected]>
GH-29531 is a backport of this pull request to the 3.9 branch. |
@@ -0,0 +1,3 @@ | |||
Reverted an argparse bugfix that caused regression in the handling of | |||
default arguments for subparsers. This prevented leaf level arguments from |
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 word "This" seems a little bit ambiguous to me. It can mean this PR (#29525) or the bugfix/regression.
…GH-29525) * Revert "bpo-45235: Fix argparse overrides namespace with subparser defaults (pythonGH-28420) (pythonGH-28443)" This reverts commit a18d522.
…GH-29525) * Revert "bpo-45235: Fix argparse overrides namespace with subparser defaults (pythonGH-28420) (pythonGH-28443)" This reverts commit a18d522.
https://bugs.python.org/issue45235