Skip to content

Commit 3c5d56b

Browse files
committed
Fix custom HelpFormatter for Python 3.14
python/cpython#132323 passes prefix_chars= (and other arguments) to the formatter_class, but the custom HelpFormatter only accepted prog=. Accept any keyword arguments and pass them on to the parent class. Fixes tox-dev#3523
1 parent 4a8e50e commit 3c5d56b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/changelog/3523.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``TypeError`` for ``HelpFormatter`` with Python 3.14

src/tox/config/cli/parser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def parse_args( # type: ignore[override] # avoid defining all overloads
9595
class HelpFormatter(ArgumentDefaultsHelpFormatter):
9696
"""A help formatter that provides the default value and the source it comes from."""
9797

98-
def __init__(self, prog: str) -> None:
99-
super().__init__(prog, max_help_position=30, width=240)
98+
def __init__(self, prog: str, **kwargs: Any) -> None:
99+
super().__init__(prog, max_help_position=30, width=240, **kwargs)
100100

101101
def _get_help_string(self, action: Action) -> str | None:
102102
text: str = super()._get_help_string(action) or ""

0 commit comments

Comments
 (0)