]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109739: regrtest disables load tracker if refleak (#109871)
authorVictor Stinner <vstinner@python.org>
Tue, 26 Sep 2023 01:05:07 +0000 (03:05 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Sep 2023 01:05:07 +0000 (01:05 +0000)
regrtest: Fix reference leak check on Windows. Disable the load
tracker on Windows in the reference leak check mode (-R option).

Lib/test/libregrtest/main.py
Misc/NEWS.d/next/Tests/2023-09-25-23-59-37.gh-issue-109739.MUn7K5.rst [new file with mode: 0644]

index a9dd08702deb5992573c7d1211bbcee30bb78876..0ec25a06b6e175b3578c46eccc3795d0841457a2 100644 (file)
@@ -20,7 +20,8 @@ from .utils import (
     StrPath, StrJSON, TestName, TestList, TestTuple, FilterTuple,
     strip_py_suffix, count, format_duration,
     printlist, get_temp_dir, get_work_dir, exit_timeout,
-    display_header, cleanup_temp_dir)
+    display_header, cleanup_temp_dir,
+    MS_WINDOWS)
 
 
 class Regrtest:
@@ -435,7 +436,15 @@ class Regrtest:
 
         setup_process()
 
-        self.logger.start_load_tracker()
+        if self.hunt_refleak and not self.num_workers:
+            # gh-109739: WindowsLoadTracker thread interfers with refleak check
+            use_load_tracker = False
+        else:
+            # WindowsLoadTracker is only needed on Windows
+            use_load_tracker = MS_WINDOWS
+
+        if use_load_tracker:
+            self.logger.start_load_tracker()
         try:
             if self.num_workers:
                 self._run_tests_mp(runtests, self.num_workers)
@@ -448,7 +457,8 @@ class Regrtest:
             if self.want_rerun and self.results.need_rerun():
                 self.rerun_failed_tests(runtests)
         finally:
-            self.logger.stop_load_tracker()
+            if use_load_tracker:
+                self.logger.stop_load_tracker()
 
         self.display_summary()
         self.finalize_tests(tracer)
diff --git a/Misc/NEWS.d/next/Tests/2023-09-25-23-59-37.gh-issue-109739.MUn7K5.rst b/Misc/NEWS.d/next/Tests/2023-09-25-23-59-37.gh-issue-109739.MUn7K5.rst
new file mode 100644 (file)
index 0000000..291524c
--- /dev/null
@@ -0,0 +1,3 @@
+regrtest: Fix reference leak check on Windows. Disable the load tracker on
+Windows in the reference leak check mode (-R option). Patch by Victor
+Stinner.