From c891d754879d9309c0b9dfd26617d93cd32f6119 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 10 Feb 2026 12:38:17 +0200 Subject: [PATCH 1/3] Ruff: target Python 3.14 syntax in Lib/test --- Lib/test/.ruff.toml | 12 +----------- Lib/test/support/import_helper.py | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml index a1b749798fa263..4825afe580d00c 100644 --- a/Lib/test/.ruff.toml +++ b/Lib/test/.ruff.toml @@ -1,6 +1,5 @@ extend = "../../.ruff.toml" # Inherit the project-wide settings - -target-version = "py312" +target-version = "py314" extend-exclude = [ # Excluded (run with the other AC files in its own separate ruff job in pre-commit) @@ -15,15 +14,6 @@ extend-exclude = [ "test_grammar.py", ] -[per-file-target-version] -# Type parameter defaults -"test_type_params.py" = "py313" - -# Template string literals -"test_annotationlib.py" = "py314" -"test_string/test_templatelib.py" = "py314" -"test_tstring.py" = "py314" - [lint] select = [ "F401", # Unused import diff --git a/Lib/test/support/import_helper.py b/Lib/test/support/import_helper.py index 093de6a82d8ca7..e8a58ed77061f5 100644 --- a/Lib/test/support/import_helper.py +++ b/Lib/test/support/import_helper.py @@ -71,7 +71,7 @@ def make_legacy_pyc(source, allow_compile=False): try: pyc_file = importlib.util.cache_from_source(source) shutil.move(pyc_file, legacy_pyc) - except (FileNotFoundError, NotImplementedError): + except FileNotFoundError, NotImplementedError: if not allow_compile: raise py_compile.compile(source, legacy_pyc, doraise=True) From d97cd97ea67282edf8b1b5cdf9ca92bcba80568e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:11:58 +0200 Subject: [PATCH 2/3] Add comment to explain target-version Co-authored-by: Alex Waygood --- Lib/test/.ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml index 4825afe580d00c..c7f6419aec9188 100644 --- a/Lib/test/.ruff.toml +++ b/Lib/test/.ruff.toml @@ -1,5 +1,5 @@ extend = "../../.ruff.toml" # Inherit the project-wide settings -target-version = "py314" +target-version = "py314" # unlike `Tools/`, tests can use newer syntax than `PYTHON_FOR_REGEN` extend-exclude = [ # Excluded (run with the other AC files in its own separate ruff job in pre-commit) From c7fa4b51b4cb3c4ab566913416c12c78f6e60d89 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:20:26 +0200 Subject: [PATCH 3/3] Apply suggestion from AA-Turner Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Lib/test/.ruff.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml index c7f6419aec9188..7b46139f786cf7 100644 --- a/Lib/test/.ruff.toml +++ b/Lib/test/.ruff.toml @@ -1,5 +1,7 @@ extend = "../../.ruff.toml" # Inherit the project-wide settings -target-version = "py314" # unlike `Tools/`, tests can use newer syntax than `PYTHON_FOR_REGEN` + +# Unlike Tools/, tests can use newer syntax than PYTHON_FOR_REGEN +target-version = "py314" extend-exclude = [ # Excluded (run with the other AC files in its own separate ruff job in pre-commit)