Skip to content

Make environment change warnings always verbose. #91674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Lib/test/libregrtest/save_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions Lib/test/support/threading_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}")

Expand Down