<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Lib/argparse.py, branch v3.8.5</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/'/>
<entry>
<title>[3.8] bpo-39546: argparse: Honor allow_abbrev=False for specified prefix_chars (GH-18337) (GH-18543)</title>
<updated>2020-02-18T11:14:07+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2020-02-18T11:14:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=e412cbba52e7cf6699720d99a4b88baef92db7b2'/>
<id>e412cbba52e7cf6699720d99a4b88baef92db7b2</id>
<content type='text'>
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 &lt;kyle@kyleam.com&gt;


https://bugs.python.org/issue39546



Automerge-Triggered-By: @encukou</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;kyle@kyleam.com&gt;


https://bugs.python.org/issue39546



Automerge-Triggered-By: @encukou</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38821: Fix crash in argparse when using gettext (GH-17192)</title>
<updated>2019-11-20T13:48:25+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-11-20T13:48:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=836f137f7ae0799de937e5281cb1da2bfdb8a69d'/>
<id>836f137f7ae0799de937e5281cb1da2bfdb8a69d</id>
<content type='text'>
(cherry picked from commit be5c79e0338005d675a64ba6e5b137e850d556d1)

Co-authored-by: Federico Bond &lt;federicobond@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit be5c79e0338005d675a64ba6e5b137e850d556d1)

Co-authored-by: Federico Bond &lt;federicobond@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37785: Fix xgettext warning in argparse (GH-15161)</title>
<updated>2019-09-13T09:45:27+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-09-13T09:45:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=8750dfe09eaec24231e19962d17d171c323794ad'/>
<id>8750dfe09eaec24231e19962d17d171c323794ad</id>
<content type='text'>
(cherry picked from commit 42671aea2db6cbc54369617da0fd3545048e0a45)

Co-authored-by: Jakub Kulík &lt;Kulikjak@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 42671aea2db6cbc54369617da0fd3545048e0a45)

Co-authored-by: Jakub Kulík &lt;Kulikjak@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[3.8] bpo-29553: Fix ArgumentParser.format_usage() for mutually exclusive groups (GH-14976) (GH-15494) (GH-15624)</title>
<updated>2019-08-30T22:25:38+00:00</updated>
<author>
<name>Raymond Hettinger</name>
<email>rhettinger@users.noreply.github.com</email>
</author>
<published>2019-08-30T22:25:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=bd8ca9aaccef0569c4b5c2e6dad0feb869ffd6c5'/>
<id>bd8ca9aaccef0569c4b5c2e6dad0feb869ffd6c5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Steven Bethard designated a new maintainer for argparse (GH-15605) (GH-15606)</title>
<updated>2019-08-30T04:27:33+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-08-30T04:27:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=c19d6bca5577547b3f4624d99b5f5f1db3e5e695'/>
<id>c19d6bca5577547b3f4624d99b5f5f1db3e5e695</id>
<content type='text'>
(cherry picked from commit 496058f59937da478eb172c864502b5dcf67705b)

Co-authored-by: Raymond Hettinger &lt;rhettinger@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 496058f59937da478eb172c864502b5dcf67705b)

Co-authored-by: Raymond Hettinger &lt;rhettinger@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-16970: Adding error message for invalid args (GH-14844)</title>
<updated>2019-08-02T05:16:44+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-08-02T05:16:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=1cc70322c99b80c123f9ff23a415d3da28b4ec74'/>
<id>1cc70322c99b80c123f9ff23a415d3da28b4ec74</id>
<content type='text'>
BPO -16970: Adding error message for invalid args

Applied the patch argparse-v2 patch issue 16970, ran patch check and the test suite, test_argparse with 0 errors

https://bugs.python.org/issue16970
(cherry picked from commit 4b3e97592376d5f8a3b75192b399a2da1be642cb)

Co-authored-by: tmblweed &lt;tmblweed@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BPO -16970: Adding error message for invalid args

Applied the patch argparse-v2 patch issue 16970, ran patch check and the test suite, test_argparse with 0 errors

https://bugs.python.org/issue16970
(cherry picked from commit 4b3e97592376d5f8a3b75192b399a2da1be642cb)

Co-authored-by: tmblweed &lt;tmblweed@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-26967: fix flag grouping with allow_abbrev=False (GH-14316) (GH-14759)</title>
<updated>2019-07-14T05:59:56+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-07-14T05:59:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=b1e4d1b6032d4c82b549233fa08a2c7cfe7e818b'/>
<id>b1e4d1b6032d4c82b549233fa08a2c7cfe7e818b</id>
<content type='text'>
The `allow_abbrev` option for ArgumentParser is documented and intended to disable support for unique prefixes of --options, which may sometimes be ambiguous due to deferred parsing.

However, the initial implementation also broke parsing of grouped short flags, such as `-ab` meaning `-a -b` (or `-a=b`).  Checking the argument for a leading `--` before rejecting it fixes this.

This was prompted by pytest-dev/pytestGH-5469, so a backport to at least 3.8 would be great :smile:
And this is my first PR to CPython, so please let me know if I've missed anything!

https://bugs.python.org/issue26967
(cherry picked from commit dffca9e925ee5c3072663cbe8d4d4768406d5307)

Co-authored-by: Zac Hatfield-Dodds &lt;Zac-HD@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `allow_abbrev` option for ArgumentParser is documented and intended to disable support for unique prefixes of --options, which may sometimes be ambiguous due to deferred parsing.

However, the initial implementation also broke parsing of grouped short flags, such as `-ab` meaning `-a -b` (or `-a=b`).  Checking the argument for a leading `--` before rejecting it fixes this.

This was prompted by pytest-dev/pytestGH-5469, so a backport to at least 3.8 would be great :smile:
And this is my first PR to CPython, so please let me know if I've missed anything!

https://bugs.python.org/issue26967
(cherry picked from commit dffca9e925ee5c3072663cbe8d4d4768406d5307)

Co-authored-by: Zac Hatfield-Dodds &lt;Zac-HD@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37150: Throw ValueError if FileType class object was passed in add_argument (GH-13805)</title>
<updated>2019-06-07T21:11:59+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-06-07T21:11:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=606ac581e2451c420117c55632f0fe13d4cec2cd'/>
<id>606ac581e2451c420117c55632f0fe13d4cec2cd</id>
<content type='text'>
There is a possibility that someone (like me) accidentally will omit parentheses with `FileType` arguments after `FileType`, and parser will contain wrong file until someone will try to use it.

Example:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```

https://bugs.python.org/issue37150
(cherry picked from commit 03d5831a2d62c68654ec223168e574cd546efbf6)

Co-authored-by: zygocephalus &lt;grrrr@protonmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a possibility that someone (like me) accidentally will omit parentheses with `FileType` arguments after `FileType`, and parser will contain wrong file until someone will try to use it.

Example:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```

https://bugs.python.org/issue37150
(cherry picked from commit 03d5831a2d62c68654ec223168e574cd546efbf6)

Co-authored-by: zygocephalus &lt;grrrr@protonmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-23378: Add an extend action to argparse (GH-13305)</title>
<updated>2019-05-21T17:47:42+00:00</updated>
<author>
<name>Batuhan Taşkaya</name>
<email>47358913+isidentical@users.noreply.github.com</email>
</author>
<published>2019-05-21T17:47:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=aa32a7e1116f7aaaef9fec453db910e90ab7b101'/>
<id>aa32a7e1116f7aaaef9fec453db910e90ab7b101</id>
<content type='text'>
Add an extend action to argparse


https://bugs.python.org/issue23378</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add an extend action to argparse


https://bugs.python.org/issue23378</pre>
</div>
</content>
</entry>
<entry>
<title>Remove superseded line from argparse.HelpFormatter() (GH-8839)</title>
<updated>2018-08-22T20:14:14+00:00</updated>
<author>
<name>Grant Jenks</name>
<email>grant.jenks@gmail.com</email>
</author>
<published>2018-08-22T20:14:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=65bef36f0bc5d8c3f6a47568012df4ae5ba2ac8b'/>
<id>65bef36f0bc5d8c3f6a47568012df4ae5ba2ac8b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
