mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-91904: Fix setting envvar PYTHONREGRTEST_UNICODE_GUARD (GH-91905)
It always failed on non-UTF-8 locale and prevented running regrtests.
This commit is contained in:
parent
93d280141c
commit
54d068adfb
3 changed files with 8 additions and 5 deletions
|
@ -5,6 +5,7 @@ import signal
|
|||
import sys
|
||||
import unittest
|
||||
from test import support
|
||||
from test.support.os_helper import TESTFN_UNDECODABLE, FS_NONASCII
|
||||
try:
|
||||
import gc
|
||||
except ImportError:
|
||||
|
@ -104,10 +105,10 @@ def setup_tests(ns):
|
|||
|
||||
# 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}",
|
||||
)
|
||||
if TESTFN_UNDECODABLE and os.supports_bytes_environ:
|
||||
os.environb.setdefault(UNICODE_GUARD_ENV.encode(), TESTFN_UNDECODABLE)
|
||||
elif FS_NONASCII:
|
||||
os.environ.setdefault(UNICODE_GUARD_ENV, FS_NONASCII)
|
||||
|
||||
|
||||
def replace_stdout():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue