summaryrefslogtreecommitdiff
path: root/Lib/test/libregrtest/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/libregrtest/setup.py')
-rw-r--r--Lib/test/libregrtest/setup.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
index 345b584199..f9460ae7ed 100644
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -14,6 +14,9 @@ from test.libregrtest.utils import (setup_unraisable_hook,
setup_threading_excepthook)
+UNICODE_GUARD_ENV = "PYTHONREGRTEST_UNICODE_GUARD"
+
+
def setup_tests(ns):
try:
stderr_fd = sys.__stderr__.fileno()
@@ -98,6 +101,13 @@ def setup_tests(ns):
from test.support.testresult import RegressionTestResult
RegressionTestResult.USE_XML = True
+ # Ensure there's a non-ASCII character in env vars at all times to force
+ # tests consider this case. See BPO-44647 for details.
+ os.environ.setdefault(
+ UNICODE_GUARD_ENV,
+ "\N{SMILING FACE WITH SUNGLASSES}",
+ )
+
def replace_stdout():
"""Set stdout encoder error handler to backslashreplace (as stderr error