gh-112527: Fix help text for required options in argparse#112528
gh-112527: Fix help text for required options in argparse#112528serhiy-storchaka merged 6 commits intopython:mainfrom
Conversation
…tter For actions with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text. Since that's a bit misleading, it is removed with this commit.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
I think it's minor enough to not require a news entry. Just let me know if you think otherwise. |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Thank you for your PR, @henzef, it looks interesting. Sorry that it took so much time to review it. Could you please add some tests?
|
And while this is not a major change, it fixes a weird behavior, and many users will be happy to hear this. This is why we have NEWS entries. |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
I added unit tests and a news entry |
Misc/NEWS.d/next/Library/2025-12-09-14-40-45.gh-issue-112527.Tvf5Zk.rst
Outdated
Show resolved
Hide resolved
|
Thanks @henzef for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
|
Sorry, @henzef and @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @henzef and @serhiy-storchaka, I could not cleanly backport this to |
pythonGH-112528) For optional arguments with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text. Since that's a bit misleading, it is removed with this commit. (cherry picked from commit 1adb17b) Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
|
GH-142475 is a backport of this pull request to the 3.14 branch. |
pythonGH-112528) For optional arguments with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text. Since that's a bit misleading, it is removed with this commit. (cherry picked from commit 1adb17b) Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
|
GH-142477 is a backport of this pull request to the 3.13 branch. |
…112528) (GH-142475) For optional arguments with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text. Since that's a bit misleading, it is removed with this commit. (cherry picked from commit 1adb17b) Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
…112528) (GH-142477) For optional arguments with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text. Since that's a bit misleading, it is removed with this commit. (cherry picked from commit 1adb17b) Co-authored-by: Fabian Henze <32638720+henzef@users.noreply.github.com>
For actions with required=True, the ArgumentDefaultsHelpFormatter would always add a " (default: None)" to the end of the help text.
Since that's a bit misleading, it is removed with this commit.