New submission from Kyle Meyer <k...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue39546>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to