bpo-45235: Revert an argparse bugfix that caused a regression#29525
bpo-45235: Revert an argparse bugfix that caused a regression#29525rhettinger merged 20 commits intopython:mainfrom
Conversation
Update to 15 March
…faults (pythonGH-28420) (pythonGH-28443)" This reverts commit a18d522.
| 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.
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.
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 <rhettinger@users.noreply.github.com>
…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 <rhettinger@users.noreply.github.com>
|
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.
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