]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-138697: Fix inferring dest from a single-dash long option in argparse (#138699)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 20 Nov 2025 18:41:58 +0000 (20:41 +0200)
committerGitHub <noreply@github.com>
Thu, 20 Nov 2025 18:41:58 +0000 (18:41 +0000)
commit77cb39e0c7ef606ef68a0e09fd7c8c9c360f97f1
treeaadc95fcb9f6ad22f0ac604007619f09b8bf13ee
parentb3383085f9c63cf4034bec13c5b20140757bebc9
gh-138697: Fix inferring dest from a single-dash long option in argparse (#138699)

* gh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <savannah@python.org>
Doc/library/argparse.rst
Doc/whatsnew/3.15.rst
Lib/argparse.py
Lib/test/test_argparse.py
Misc/NEWS.d/next/Library/2025-09-09-13-00-42.gh-issue-138697.QVwJw_.rst [new file with mode: 0644]