[3.12] gh-104860: Fix allow_abbrev=False for single-dash long options (GH-124340) (GH-124750)

(cherry picked from commit 49e105f948)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-09-29 10:16:38 +02:00 committed by GitHub
parent 65103adadd
commit 00fd32af21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View file

@ -2361,7 +2361,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
action = self._option_string_actions[option_string]
tup = action, option_string, '', short_explicit_arg
result.append(tup)
elif option_string.startswith(option_prefix):
elif self.allow_abbrev and option_string.startswith(option_prefix):
action = self._option_string_actions[option_string]
tup = action, option_string, None, None
result.append(tup)