]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-144639: Ruff: target Python 3.14 syntax in `Lib/test` (#144656)
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Wed, 11 Feb 2026 14:12:31 +0000 (16:12 +0200)
committerGitHub <noreply@github.com>
Wed, 11 Feb 2026 14:12:31 +0000 (14:12 +0000)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Lib/test/.ruff.toml
Lib/test/support/import_helper.py

index a1b749798fa263a2bae6e930dcc23d6b2187dabc..7b46139f786cf77733d217d2da9b45792a634aa6 100644 (file)
@@ -1,6 +1,7 @@
 extend = "../../.ruff.toml"  # Inherit the project-wide settings
 
-target-version = "py312"
+# 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)
@@ -15,15 +16,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
index 093de6a82d8ca75e6a14e72f8ea1bdf959fcaf70..e8a58ed77061f55ce686e7bf0937a88001be8d63 100644 (file)
@@ -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)