You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argparse incorrectly says arguments are required #103219
I don't think this needs to be fixed. It's an attempt to correct minor issue in the error message.
Normally '*' and '?' positionals are 'seen', because an empty list of arguments meets their nargs requirments.
In this case required 'foo' positional, blocks all further processing of positionals, including 'bar'. 'bar' can't be filled, with default or not, until 'foo' has been filled.
Activity
ericvsmith commentedon Apr 3, 2023
You'll need to show your code, otherwise we can't tell if this is a bug in argparse or your code. Please create a minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example
eslindsey commentedon Apr 3, 2023
Added a minimal reproducible example.
sobolevn commentedon Apr 3, 2023
The patch can look something like this:
On line
cpython/Lib/argparse.py
Line 2127 in 24facd6
Test case:
But, I don't feel confident submitting
argparsepatches. I hope this will help someone else :)hpaulj commentedon Apr 18, 2023
I don't think this needs to be fixed. It's an attempt to correct minor issue in the error message.
Normally '*' and '?' positionals are 'seen', because an empty list of arguments meets their
nargsrequirments.In this case required 'foo' positional, blocks all further processing of positionals, including 'bar'. 'bar' can't be filled, with default or not, until 'foo' has been filled.
sobolevn commentedon Apr 19, 2023
Why don't we need to fix an error message?
Merge branch 'main' into pythongh-103219
serhiy-storchaka commentedon Sep 21, 2024
This is a duplicate of #72795.
ericvsmith commentedon Sep 23, 2024
Since it's a duplicate, I'm closing this.