bpo-37069: regrtest uses sys.unraisablehook (GH-13759)
regrtest now uses sys.unraisablehook() to mark a test as "environment
altered" (ENV_CHANGED) if it emits an "unraisable exception".
Moreover, regrtest logs a warning in this case.
Use "python3 -m test --fail-env-changed" to catch unraisable
exceptions in tests.
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
index fb5ac35..36676bf 100644
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -10,6 +10,8 @@
except ImportError:
gc = None
+from test.libregrtest.utils import setup_unraisable_hook
+
def setup_tests(ns):
try:
@@ -93,6 +95,8 @@
pass
sys.addaudithook(_test_audit_hook)
+ setup_unraisable_hook()
+
def suppress_msvcrt_asserts(verbose):
try: