Skip to content

Commit

Permalink
Avoid double search
Browse files Browse the repository at this point in the history
  • Loading branch information
kkarbowiak committed Oct 21, 2022
1 parent b26fdb4 commit a4597b1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Lib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,11 +1542,10 @@ def _get_positional_kwargs(self, dest, **kwargs):

# make sure 'store_true', 'store_false', or 'store_const' action
# is not specified
if 'action' in kwargs:
action = kwargs.get('action')
if action in ('store_true', 'store_false', 'store_const'):
msg = _("{action} is an invalid action for positionals", {'action': action})
raise TypeError(msg)
action = kwargs.get('action')
if action in ('store_true', 'store_false', 'store_const'):
msg = _("{action} is an invalid action for positionals", {'action': action})
raise TypeError(msg)

# mark positional arguments as required if at least one is
# always required
Expand Down

0 comments on commit a4597b1

Please sign in to comment.