From 17cf20500b3cc37824c14906ac8616292e31de3f Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Mon, 12 May 2025 18:03:59 +0200 Subject: [PATCH] Support Python 3.14.0b1 --- 3524.patch | 40 ++++++++++++++++++++++++++++++++++++++++ python-tox.spec | 3 +++ 2 files changed, 43 insertions(+) create mode 100644 3524.patch diff --git a/3524.patch b/3524.patch new file mode 100644 index 0000000..48046a4 --- /dev/null +++ b/3524.patch @@ -0,0 +1,40 @@ +From 3c5d56bf8bb8405d0eceef912ba4cad7d077448c Mon Sep 17 00:00:00 2001 +From: Florian Bruhin +Date: Thu, 8 May 2025 10:47:22 +0200 +Subject: [PATCH] Fix custom HelpFormatter for Python 3.14 + +https://github.com/python/cpython/pull/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 #3523 +--- + docs/changelog/3523.bugfix.rst | 1 + + src/tox/config/cli/parser.py | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + create mode 100644 docs/changelog/3523.bugfix.rst + +diff --git a/docs/changelog/3523.bugfix.rst b/docs/changelog/3523.bugfix.rst +new file mode 100644 +index 000000000..3052d877e +--- /dev/null ++++ b/docs/changelog/3523.bugfix.rst +@@ -0,0 +1 @@ ++Fix ``TypeError`` for ``HelpFormatter`` with Python 3.14 +diff --git a/src/tox/config/cli/parser.py b/src/tox/config/cli/parser.py +index 87629ae49..904ff7aad 100644 +--- a/src/tox/config/cli/parser.py ++++ b/src/tox/config/cli/parser.py +@@ -95,8 +95,8 @@ def parse_args( # type: ignore[override] # avoid defining all overloads + class HelpFormatter(ArgumentDefaultsHelpFormatter): + """A help formatter that provides the default value and the source it comes from.""" + +- def __init__(self, prog: str) -> None: +- super().__init__(prog, max_help_position=30, width=240) ++ def __init__(self, prog: str, **kwargs: Any) -> None: ++ super().__init__(prog, max_help_position=30, width=240, **kwargs) + + def _get_help_string(self, action: Action) -> str | None: + text: str = super()._get_help_string(action) or "" diff --git a/python-tox.spec b/python-tox.spec index 4dc498f..41c73e7 100644 --- a/python-tox.spec +++ b/python-tox.spec @@ -28,6 +28,9 @@ License: MIT URL: https://tox.readthedocs.io/ Source: %{pypi_source tox} +# Support Python 3.14.0b1 +Patch: https://github.com/tox-dev/tox/pull/3524.patch + # Remove dependency on devpi-process. # Remove dependency on detect-test-pollution. # Remove coverage-related dependencies.