diff --git a/argcomplete/packages/_argparse.py b/argcomplete/packages/_argparse.py index 7a8b4fc8..2a064f9a 100644 --- a/argcomplete/packages/_argparse.py +++ b/argcomplete/packages/_argparse.py @@ -162,7 +162,10 @@ def take_action(action, argument_strings, option_string=None): def consume_optional(start_index): # get the optional identified at this index option_tuple = option_string_indices[start_index] - action, option_string, explicit_arg = option_tuple + if len(option_tuple) == 3: + action, option_string, explicit_arg = option_tuple + else: # Python 3.11.9+, 3.12.3+, 3.13+ + action, option_string, _, explicit_arg = option_tuple # identify additional optionals in the same arg string # (e.g. -xyz is the same as -x -y -z if no args are required)