Open bfrascher opened 6 years ago
That's almost consistent with python's behavior. In fact, it should already quit after the first call of parse_args()
:
% python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo')
_StoreAction(option_strings=[], dest='foo', nargs=None, const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> parser.parse_args()
usage: [-h] foo
: error: the following arguments are required: foo
%
So, there is a bug, but a different one.
I was testing around some things with the
argparse
module inbpython
when suddenlybpython
quit on me with error code 1. I tried to break the problem down and the code below seems to be the minimal reproducer:The second
parser.parse_args()
is not entered by me, but appears automatically on executing the firstparser.parse_args()
line.