https://github.com/python/cpython/commit/ae208d5665453aca414d87fb1894bf0bbb677003
commit: ae208d5665453aca414d87fb1894bf0bbb677003
branch: main
author: Stan Ulbrych <[email protected]>
committer: hugovk <[email protected]>
date: 2026-03-04T22:43:44+02:00
summary:

Fix bugs in `compute-changes.py` logic for CIFuzz (#145232)

files:
M Lib/test/test_tools/test_compute_changes.py
M Tools/build/compute-changes.py

diff --git a/Lib/test/test_tools/test_compute_changes.py 
b/Lib/test/test_tools/test_compute_changes.py
index b20ff975fc2834..c4e3ffdb4de6cf 100644
--- a/Lib/test/test_tools/test_compute_changes.py
+++ b/Lib/test/test_tools/test_compute_changes.py
@@ -6,7 +6,8 @@
 from pathlib import Path
 from unittest.mock import patch
 
-from test.test_tools import skip_if_missing, imports_under_tool
+from test.support import os_helper
+from test.test_tools import basepath, skip_if_missing, imports_under_tool
 
 skip_if_missing("build")
 
@@ -15,6 +16,7 @@
         compute_changes = importlib.import_module("compute-changes")
 
 process_changed_files = compute_changes.process_changed_files
+is_fuzzable_library_file = compute_changes.is_fuzzable_library_file
 Outputs = compute_changes.Outputs
 ANDROID_DIRS = compute_changes.ANDROID_DIRS
 IOS_DIRS = compute_changes.IOS_DIRS
@@ -45,16 +47,16 @@ def test_docs(self):
                 self.assertFalse(result.run_tests)
 
     def test_ci_fuzz_stdlib(self):
-        for p in LIBRARY_FUZZER_PATHS:
-            with self.subTest(p=p):
-                if p.is_dir():
-                    f = p / "file"
-                elif p.is_file():
-                    f = p
-                else:
-                    continue
-                result = process_changed_files({f})
-                self.assertTrue(result.run_ci_fuzz_stdlib)
+        with os_helper.change_cwd(basepath):
+            for p in LIBRARY_FUZZER_PATHS:
+                with self.subTest(p=p):
+                    if p.is_dir():
+                        f = p / "file"
+                    elif p.is_file():
+                        f = p
+                    result = process_changed_files({f})
+                    self.assertTrue(result.run_ci_fuzz_stdlib)
+                    self.assertTrue(is_fuzzable_library_file(f))
 
     def test_android(self):
         for d in ANDROID_DIRS:
diff --git a/Tools/build/compute-changes.py b/Tools/build/compute-changes.py
index 67d2b060969660..981e00e28b42a7 100644
--- a/Tools/build/compute-changes.py
+++ b/Tools/build/compute-changes.py
@@ -68,7 +68,8 @@
     Path("Lib/encodings/"),
     Path("Modules/_codecsmodule.c"),
     Path("Modules/cjkcodecs/"),
-    Path("Modules/unicodedata*"),
+    Path("Modules/unicodedata.c"),
+    Path("Modules/unicodedata_db.h"),
     # difflib
     Path("Lib/difflib.py"),
     # email
@@ -116,10 +117,10 @@ class Outputs:
 
 
 def compute_changes() -> None:
-    target_branch, head_ref = git_refs()
+    target_ref, head_ref = git_refs()
     if os.environ.get("GITHUB_EVENT_NAME", "") == "pull_request":
         # Getting changed files only makes sense on a pull request
-        files = get_changed_files(target_branch, head_ref)
+        files = get_changed_files(target_ref, head_ref)
         outputs = process_changed_files(files)
     else:
         # Otherwise, just run the tests
@@ -132,6 +133,7 @@ def compute_changes() -> None:
             run_wasi=True,
             run_windows_tests=True,
         )
+    target_branch = target_ref.removeprefix("origin/")
     outputs = process_target_branch(outputs, target_branch)
 
     if outputs.run_tests:

_______________________________________________
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