https://github.com/python/cpython/commit/81484c5629f9d8b698a2be58f850a0e4efe48ed3
commit: 81484c5629f9d8b698a2be58f850a0e4efe48ed3
branch: main
author: Hugo van Kemenade <[email protected]>
committer: AA-Turner <[email protected]>
date: 2026-02-11T14:12:31Z
summary:

gh-144639: Ruff: target Python 3.14 syntax in `Lib/test` (#144656)

Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Adam Turner <[email protected]>

files:
M Lib/test/.ruff.toml
M Lib/test/support/import_helper.py

diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml
index a1b749798fa263..7b46139f786cf7 100644
--- a/Lib/test/.ruff.toml
+++ b/Lib/test/.ruff.toml
@@ -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
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)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to