bpo-39983: Add test.support.print_warning() (GH-19683)
Log "Warning -- ..." test warnings into sys.__stderr__ rather than
sys.stderr, to ensure to display them even if sys.stderr is captured.
test.libregrtest.utils.print_warning() now calls
test.support.print_warning().
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 40faed8..0368694 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -62,7 +62,7 @@
def print_warning(msg):
- print(f"Warning -- {msg}", file=sys.stderr, flush=True)
+ support.print_warning(msg)
orig_unraisablehook = None