Skip to content

Commit

Permalink
pythongh-109739: regrtest disables load tracker if refleak (python#10…
Browse files Browse the repository at this point in the history
…9871)

regrtest: Fix reference leak check on Windows. Disable the load
tracker on Windows in the reference leak check mode (-R option).
  • Loading branch information
vstinner authored Sep 26, 2023
1 parent e5186c3 commit 4091deb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
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:
Expand Down Expand Up @@ -435,7 +436,15 @@ def _run_tests(self, selected: TestTuple, tests: TestList | None) -> int:

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)
Expand All @@ -448,7 +457,8 @@ def _run_tests(self, selected: TestTuple, tests: TestList | None) -> int:
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 4091deb

Please sign in to comment.