From: Victor Stinner Date: Tue, 26 Sep 2023 01:05:07 +0000 (+0200) Subject: gh-109739: regrtest disables load tracker if refleak (#109871) X-Git-Tag: v3.13.0a1~297 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4091deba88946841044b0a54090492a2fd903d42;p=thirdparty%2FPython%2Fcpython.git gh-109739: regrtest disables load tracker if refleak (#109871) regrtest: Fix reference leak check on Windows. Disable the load tracker on Windows in the reference leak check mode (-R option). --- diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index a9dd08702deb..0ec25a06b6e1 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -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 index 000000000000..291524c758ca --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-09-25-23-59-37.gh-issue-109739.MUn7K5.rst @@ -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.