[issue39546] argparse: allow_abbrev=False is ignored for alternative prefix characters
Kyle Meyer
report at bugs.python.org
Mon Feb 3 15:11:28 EST 2020
New submission from Kyle Meyer <kyle at kyleam.com>:
As of Python v3.8.0 (specifically commit b1e4d1b603), specifying
`allow_abbrev=False` does not disable abbreviation for prefix
characters other than '-'.
--8<---------------cut here---------------start------------->8---
import argparse
parser = argparse.ArgumentParser(prefix_chars='+', allow_abbrev=False)
parser.add_argument('++long')
print(parser.parse_args(['++lo=val']))
--8<---------------cut here---------------end--------------->8---
Observed output (with b1e4d1b603 and current master):
Namespace(long='val')
Expected (and observed with b1e4d1b603^ and 3.7.3):
usage: scratch.py [+h] [++long LONG]
scratch.py: error: unrecognized arguments: ++lo=val
I will follow up with a PR to propose a fix.
----------
components: Library (Lib)
messages: 361326
nosy: kyleam
priority: normal
severity: normal
status: open
title: argparse: allow_abbrev=False is ignored for alternative prefix characters
type: behavior
versions: Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39546>
_______________________________________
More information about the Python-bugs-list
mailing list