[New-bugs-announce] [issue42457] ArgumentParser nested subparsers resolve paths in improper order
Carson Wilber
report at bugs.python.org
Tue Nov 24 23:36:54 EST 2020
New submission from Carson Wilber <carsonwilber at gmail.com>:
ArgumentParser improperly resolves arguments in an improper order when using nested subparsers if there are required arguments at more than one layer.
A minimum viable reproduction is to create a set of subparsers on a primary parser, and a set of subparsers on at least one of those parsers. On the main parser and the first-level subparser, add a required argument (in any position as they are appended to the end.)
If you attempt to, for example, print the help for a second-level subparser, an error will be thrown and the parser will exit due to the required argument(s) not being provided, despite the expected behavior and the nature of the -h flag not requiring those arguments to be provided.
For lack of an appropriate means to show a complete minimum viable reproduction here, please see this StackOverflow thread I initially created believing this to be user error (having now determined this is a bug in behavior):
https://stackoverflow.com/questions/64908447/printing-help-for-nested-subparsers-with-required-positional-arguments
----------
messages: 381789
nosy: carsonwilber
priority: normal
severity: normal
status: open
title: ArgumentParser nested subparsers resolve paths in improper order
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42457>
_______________________________________
More information about the New-bugs-announce
mailing list