summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-02-05 20:42:43 (GMT)
committerGitHub <noreply@github.com>2024-02-05 20:42:43 (GMT)
commit4aa4f0906df9fc9c6c6f6657f2c521468c6b1688 (patch)
tree7981fa18e770c7ce82517eec79b3944ce5a84d4e /Lib/argparse.py
parent750489cc774df44daa2c0d23e8a404fe62be93d1 (diff)
downloadcpython-4aa4f0906df9fc9c6c6f6657f2c521468c6b1688.zip
cpython-4aa4f0906df9fc9c6c6f6657f2c521468c6b1688.tar.gz
cpython-4aa4f0906df9fc9c6c6f6657f2c521468c6b1688.tar.bz2
gh-109475: Fix support of explicit option value "--" in argparse (GH-114814)
For example "--option=--".
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 9e19f39..2131d72 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -2485,7 +2485,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# ========================
def _get_values(self, action, arg_strings):
# for everything but PARSER, REMAINDER args, strip out first '--'
- if action.nargs not in [PARSER, REMAINDER]:
+ if not action.option_strings and action.nargs not in [PARSER, REMAINDER]:
try:
arg_strings.remove('--')
except ValueError: