summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-09-29 07:44:34 (GMT)
committerGitHub <noreply@github.com>2024-09-29 07:44:34 (GMT)
commit49e105f9488de18d3d92948232fcbd956cbe0c6e (patch)
tree69c33024170ad29548aebad862df000d4d93c781 /Lib/argparse.py
parentd08c7888229e78533648191dfe42e2d2d3ecea25 (diff)
downloadcpython-49e105f9488de18d3d92948232fcbd956cbe0c6e.zip
cpython-49e105f9488de18d3d92948232fcbd956cbe0c6e.tar.gz
cpython-49e105f9488de18d3d92948232fcbd956cbe0c6e.tar.bz2
gh-104860: Fix allow_abbrev=False for single-dash long options (GH-124340)
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 690b2a9..4506a5e 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -2328,7 +2328,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)