]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-96310: Fix a traceback in argparse when all options in a mutually exclusive...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 21 Feb 2024 16:20:29 +0000 (17:20 +0100)
committerGitHub <noreply@github.com>
Wed, 21 Feb 2024 16:20:29 +0000 (18:20 +0200)
commitdae7341da27a6004d985f1fd696f755f634bf61e
treec4352b716d856a1f9ee4dc0f5eb27b95c245037f
parent2ea2d25cc67e268975d471a367478fbe48880743
[3.12] gh-96310: Fix a traceback in argparse when all options in a mutually exclusive group are suppressed (GH-96311) (GH-115767)

Reproducer depends on terminal size - the traceback occurs when there's
an option long enough so the usage line doesn't fit the terminal width.
Option order is also important for reproducibility.

Excluding empty groups (with all options suppressed) from inserts
fixes the problem.
(cherry picked from commit 5f7df88821347c5f44fc4e2c691e83a60a6c6cd5)

Co-authored-by: Daniel Mach <daniel.mach@suse.com>
Lib/argparse.py
Lib/test/test_argparse.py
Misc/NEWS.d/next/Library/2022-08-26-15-50-53.gh-issue-96310.0NssDh.rst [new file with mode: 0644]