diff options
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/argparse.py | 2 | ||||
| -rw-r--r-- | Lib/test/test_argparse.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index e3da7f0443..e0e367bf20 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1077,7 +1077,7 @@ class _SubParsersAction(Action): prog, parser_class, dest=SUPPRESS, - required=True, + required=False, help=None, metavar=None): diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index c4440e4df7..bcf15ce123 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -1932,7 +1932,9 @@ class TestAddSubparsers(TestCase): parser = ErrorRaisingArgumentParser() subparsers = parser.add_subparsers(dest='command') subparsers.add_parser('run') - self._test_required_subparsers(parser) + # No error here + ret = parser.parse_args(()) + self.assertIsNone(ret.command) def test_optional_subparsers(self): parser = ErrorRaisingArgumentParser() |
