[issue45235] argparse does not preserve namespace with subparser defaults

2021-12-22 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45235] argparse does not preserve namespace with subparser defaults

2021-12-21 Thread Frost Ming
Frost Ming added the comment: Per the review comments of @jiasli, I worked out a second PR to fix this issue. This fix has less side-effect and better backward compatibility. I will leave the two PRs open. Any feedback is welcome. - Frost -- ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-12-21 Thread Frost Ming
Change by Frost Ming : -- pull_requests: +28441 pull_request: https://github.com/python/cpython/pull/30219 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-22 Thread Frost Ming
Frost Ming added the comment: Hi, I noticed this bug because of the regression of Python 3.9.8. And I proposed a better approach in PR 29574. Maybe the folks here can have a look. Thanks - Frost -- ___ Python tracker

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: Paul, should this be closed or do you think there is still a namespace issue to be resolved? -- assignee: rhettinger -> ___ Python tracker

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-16 Thread Frost Ming
Change by Frost Ming : -- nosy: +Frost Ming nosy_count: 10.0 -> 11.0 pull_requests: +27818 pull_request: https://github.com/python/cpython/pull/29574 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset e4c5a5eabadd1dcd0b522ffbd70157cd95506ad1 by Miss Islington (bot) in branch '3.10': bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) (GH-29530)

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've restored the prior state of affairs. Leaving this issue open because it still isn't clear what should be guaranteed or whether further improvements need to be made. -- priority: high -> normal ___ Python

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 587ff7f50bcbfd8346c6d5db459a1628a350c04d by Miss Islington (bot) in branch '3.9': bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) (GH-29531)

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +27781 pull_request: https://github.com/python/cpython/pull/29531 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +27780 pull_request: https://github.com/python/cpython/pull/29530 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 807f839bbfd5805fb76eb3436c9252a0441296eb by Raymond Hettinger in branch 'main': bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) https://github.com/python/cpython/commit/807f839bbfd5805fb76eb3436c9252a0441296eb

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: Only 3.9 needs an expedited rerelease. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: The next bugfixe release of 3.10 is the 6th of December -- ___ Python tracker ___ ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: How long until the next bugfix releases for 3.9 and 3.10? To avoid further snowballing, it would be great to have this reversion pushed out soonish. -- nosy: +pablogsal priority: normal -> high ___ Python

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +27775 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/29525 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-10 Thread Łukasz Langa
Łukasz Langa added the comment: Go for it, Raymond. -- nosy: +lukasz.langa resolution: fixed -> stage: test needed -> needs patch ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: Unless anyone objects, I'll revert this across all affected branches. -- ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-10 Thread Guido van Rossum
Guido van Rossum added the comment: This has caused a regression, also reported here: https://github.com/Azure/azure-cli/issues/20269 Global Arguments stop working in Python 3.9.8 Can we please get some attention from @rhettinger and @ambv? -- nosy: +gvanrossum

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-10 Thread Łukasz Wałejko
Łukasz Wałejko added the comment: I can also confirm that there is an regression in Python 3.9.8 regarding argparse For example, using watchdog 2.1.6 package Python 3.9.7 (correct behaviour) In [1]: from watchdog import watchmedo In [2]: watchmedo.cli.parse_args(["auto-restart", "echo",

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-09 Thread RhinosF1
Change by RhinosF1 : -- nosy: +RhinosF1 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-09 Thread dgw
dgw added the comment: Can confirm that this patch DOES cause backward compatibility issues, as paul.j3's gut feeling said it could. One of my projects, testing against 3.6-3.9, now fails its test suite on Python 3.9.8, which includes this change. Arguments passed to a subparser are indeed

[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-27 Thread paul j3
paul j3 added the comment: I should study previous posts in more detail, but here are some thoughts on correctly handling user namespace. At the start of `parse_known_args`, there's a if namespace is None: namespace = Namespace() We need to hang on to a copy of this

[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-26 Thread paul j3
Change by paul j3 : -- stage: resolved -> test needed status: closed -> pending ___ Python tracker ___ ___ Python-bugs-list mailing

[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3
paul j3 added the comment: parser = argparse.ArgumentParser() sub = parser.add_subparsers() example_subparser = sub.add_parser("example") example_subparser.add_argument("--flag", default=10) print(parser.parse_args(["example","--flag=15"], argparse.Namespace(flag=20))) still

[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3
paul j3 added the comment: I just downloaded this `argparse.py`. This change makes it impossible to use a subparser argument if it is defined in the user provided namespace, or by the main parser. It blocks not only subparser default, but also user input. It has reverted the 9351 patch

[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3
paul j3 added the comment: I haven't studied or tested this change, but it looks like a partial retraction of https://bugs.python.org/issue9351 argparse set_defaults on subcommands should override top level set_defaults Originally the main namespace was passed to the subparser. Steven

[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3
Change by paul j3 : -- nosy: +paul.j3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-18 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset a18d52269ab6071a605d6c72f6af585a4c533ca4 by Miss Islington (bot) in branch '3.9': bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) (GH-28443)

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 6e4101add568910409294554c8e863226a66bb64 by Miss Islington (bot) in branch '3.10': bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) (GH-28442)

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-17 Thread miss-islington
Change by miss-islington : -- pull_requests: +26846 pull_request: https://github.com/python/cpython/pull/28443 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset a6e8db5e8e6780411db749d404715dbe021647c7 by Adam Schwalm in branch 'main': bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) https://github.com/python/cpython/commit/a6e8db5e8e6780411db749d404715dbe021647c7

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-17 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 2.0 -> 3.0 pull_requests: +26845 pull_request: https://github.com/python/cpython/pull/28442 ___ Python tracker

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-17 Thread Adam Schwalm
Change by Adam Schwalm : -- keywords: +patch pull_requests: +26832 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28420 ___ Python tracker ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-17 Thread Adam Schwalm
New submission from Adam Schwalm : The following snippet demonstrates the problem. If a subparser flag has a default set, argparse will override the existing value in the provided 'namespace' if the flag does not appear (e.g., if the default is used): import argparse parser =