Skip to content

Commit b61635b

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix Python 3.12 compatibility"
2 parents 543f812 + d27282b commit b61635b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

novaclient/shell.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,11 @@ def _get_option_tuples(self, option_string):
232232
option_tuples = (super(NovaClientArgumentParser, self)
233233
._get_option_tuples(option_string))
234234
if len(option_tuples) > 1:
235-
normalizeds = [option.replace('_', '-')
236-
for action, option, value in option_tuples]
235+
# In Python < 3.12, this is a 3-part tuple:
236+
# action, option_string, explicit_arg
237+
# In Python >= 3.12, this is a 4 part tuple:
238+
# action, option_string, sep, explicit_arg
239+
normalizeds = [opt[1].replace('_', '-') for opt in option_tuples]
237240
if len(set(normalizeds)) == 1:
238241
return option_tuples[:1]
239242
return option_tuples

0 commit comments

Comments
 (0)