From 9bf2a5c00c10727cd415287935ae9eee16c81da9 Mon Sep 17 00:00:00 2001 From: 369koushil Date: Sun, 16 Nov 2025 08:22:13 +0530 Subject: [PATCH 1/4] argparse: avoid redundant early _set_color() call in HelpFormatter.__init__ --- Lib/argparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/argparse.py b/Lib/argparse.py index 6b79747572f48f..aa56d30f395cd3 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -174,7 +174,7 @@ def __init__( width = shutil.get_terminal_size().columns width -= 2 - self._set_color(color) + self._color = color self._prog = prog self._indent_increment = indent_increment self._max_help_position = min(max_help_position, From 485fa3685fff7dd97b10a08d42e987ce81400131 Mon Sep 17 00:00:00 2001 From: 369koushil Date: Sun, 16 Nov 2025 10:02:37 +0530 Subject: [PATCH 2/4] Add NEWS entry for gh-141571 --- Misc/NEWS.d/next/gh-141571.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/gh-141571.bugfix.rst diff --git a/Misc/NEWS.d/next/gh-141571.bugfix.rst b/Misc/NEWS.d/next/gh-141571.bugfix.rst new file mode 100644 index 00000000000000..360ed5a4954e9b --- /dev/null +++ b/Misc/NEWS.d/next/gh-141571.bugfix.rst @@ -0,0 +1 @@ +Fix redundant early _set_color() call in argparse.HelpFormatter to avoid double color initialization. From fd0feaed067181427d6b9008c35b3294bc65febd Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 16 Nov 2025 06:33:32 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-11-16-06-33-31.gh-issue-141571.n2n0BX.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-11-16-06-33-31.gh-issue-141571.n2n0BX.rst diff --git a/Misc/NEWS.d/next/Library/2025-11-16-06-33-31.gh-issue-141571.n2n0BX.rst b/Misc/NEWS.d/next/Library/2025-11-16-06-33-31.gh-issue-141571.n2n0BX.rst new file mode 100644 index 00000000000000..8883607ada8688 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-11-16-06-33-31.gh-issue-141571.n2n0BX.rst @@ -0,0 +1 @@ +Avoid redundant color initialization in argparse.HelpFormatter. Patch by Chilla Kalyan. From 74536110de8f4eb12200b745241b6d7a95883adc Mon Sep 17 00:00:00 2001 From: 369koushil Date: Sun, 16 Nov 2025 12:10:26 +0530 Subject: [PATCH 4/4] Add blurb-generated NEWS entry for gh-141571 --- Misc/NEWS.d/next/gh-141571.bugfix.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/gh-141571.bugfix.rst diff --git a/Misc/NEWS.d/next/gh-141571.bugfix.rst b/Misc/NEWS.d/next/gh-141571.bugfix.rst deleted file mode 100644 index 360ed5a4954e9b..00000000000000 --- a/Misc/NEWS.d/next/gh-141571.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix redundant early _set_color() call in argparse.HelpFormatter to avoid double color initialization.