Skip to content

Commit 54a4846

Browse files
committed
Preserve compatibility with argparse option tuples of length 4
1 parent 057faff commit 54a4846

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

argcomplete/packages/_argparse.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ def take_action(action, argument_strings, option_string=None):
162162
def consume_optional(start_index):
163163
# get the optional identified at this index
164164
option_tuple = option_string_indices[start_index]
165-
action, option_string, explicit_arg = option_tuple
165+
if len(option_tuple) == 3:
166+
action, option_string, explicit_arg = option_tuple
167+
else: # Python 3.11.9+, 3.12.3+, 3.13+
168+
action, option_string, _, explicit_arg = option_tuple
166169

167170
# identify additional optionals in the same arg string
168171
# (e.g. -xyz is the same as -x -y -z if no args are required)

0 commit comments

Comments
 (0)