diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py index f0bfcf389992d8..449bf9ce398fe1 100644 --- a/Lib/test/libregrtest/save_env.py +++ b/Lib/test/libregrtest/save_env.py @@ -319,8 +319,9 @@ def __exit__(self, exc_type, exc_val, exc_tb): if current != original: support.environment_altered = True restore(original) - if not self.quiet and not self.pgo: - print_warning(f"{name} was modified by {self.testname}") - print(f" Before: {original}\n After: {current} ", - file=sys.stderr, flush=True) + if not self.pgo: + print_warning( + f"{name} was modified by {self.testname}\n" + f" Before: {original}\n" + f" After: {current} ") return False diff --git a/Lib/test/support/threading_helper.py b/Lib/test/support/threading_helper.py index 92a64e8354acbc..30750e2e5e945a 100644 --- a/Lib/test/support/threading_helper.py +++ b/Lib/test/support/threading_helper.py @@ -21,14 +21,14 @@ def threading_setup(): - return _thread._count(), threading._dangling.copy() + return _thread._count(), threading._dangling.copy(), threading.get_ident() def threading_cleanup(*original_values): _MAX_COUNT = 100 for count in range(_MAX_COUNT): - values = _thread._count(), threading._dangling + values = _thread._count(), threading._dangling, threading.get_ident() if values == original_values: break @@ -39,7 +39,8 @@ def threading_cleanup(*original_values): support.print_warning(f"threading_cleanup() failed to cleanup " f"{values[0] - original_values[0]} threads " f"(count: {values[0]}, " - f"dangling: {len(dangling_threads)})") + f"dangling: {len(dangling_threads)}), " + f"ident before {values[2]} ident after {values[2]})") for thread in dangling_threads: support.print_warning(f"Dangling thread: {thread!r}")