Skip to content

Commit cd877d9

Browse files
committed
handle description set conditions
1 parent 7034e2e commit cd877d9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Lib/argparse.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,9 +1260,12 @@ def add_parser(self, name, *, deprecated=False, **kwargs):
12601260
raise ValueError(f'conflicting subparser alias: {alias}')
12611261

12621262
# Handle help/description logic
1263-
help = kwargs.pop('help', None)
1264-
if 'description' not in kwargs and help is not None:
1265-
kwargs['description'] = help
1263+
if 'help' in kwargs:
1264+
help = kwargs['help']
1265+
if help is not None and 'description' not in kwargs:
1266+
kwargs['description'] = help
1267+
else:
1268+
help = None
12661269

12671270
# Create the parser and pseudo-action
12681271
parser = self._parser_class(**kwargs)

0 commit comments

Comments
 (0)