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, 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.