diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-02-18 11:14:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 11:14:07 (GMT) |
commit | e412cbba52e7cf6699720d99a4b88baef92db7b2 (patch) | |
tree | b7c980cf29ccfbfec340dfd059bec1392e4f8cf0 /Misc/ACKS | |
parent | 7fd752c1bc637aeca2bd122d07c0ebc379d0d8ca (diff) | |
download | cpython-e412cbba52e7cf6699720d99a4b88baef92db7b2.zip cpython-e412cbba52e7cf6699720d99a4b88baef92db7b2.tar.gz cpython-e412cbba52e7cf6699720d99a4b88baef92db7b2.tar.bz2 |
[3.8] bpo-39546: argparse: Honor allow_abbrev=False for specified prefix_chars (GH-18337) (GH-18543)
When `allow_abbrev` was first added, disabling the abbreviation of
long options broke the grouping of short flags ([bpo-26967](https://bugs.python.org/issue26967)). As a fix,
b1e4d1b603 (contained in v3.8) ignores `allow_abbrev=False` for a
given argument string if the string does _not_ start with "--"
(i.e. it doesn't look like a long option).
This fix, however, doesn't take into account that long options can
start with alternative characters specified via `prefix_chars`,
introducing a regression: `allow_abbrev=False` has no effect on long
options that start with an alternative prefix character.
The most minimal fix would be to replace the "starts with --" check
with a "starts with two prefix_chars characters". But
`_get_option_tuples` already distinguishes between long and short
options, so let's instead piggyback off of that check by moving the
`allow_abbrev` condition into `_get_option_tuples`.
https://bugs.python.org/issue39546
(cherry picked from commit 8edfc47baec7ff4cb1b9db83dd35c8ffc1d498a4)
Co-authored-by: Kyle Meyer <kyle@kyleam.com>
https://bugs.python.org/issue39546
Automerge-Triggered-By: @encukou
Diffstat (limited to 'Misc/ACKS')
-rw-r--r-- | Misc/ACKS | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1096,6 +1096,7 @@ Brian Merrell Alexis Métaireau Luke Mewburn Carl Meyer +Kyle Meyer Mike Meyer Piotr Meyer Steven Miale |