LC_ALL is read before LANG to choose the locale encoding (LC_ALL, LANG and then
LC_CTYPE: use the first non empty variable).
undecodable = b"\xff"
env = os.environ.copy()
- env['LANG'] = 'C'
+ # Use C locale to get ascii for the locale encoding
+ env['LC_ALL'] = 'C'
code = (
b'import locale; '
b'print(ascii("' + undecodable + b'"), '
# Raise SkipTest() if sys.executable is not encodable to ascii
test.support.workaroundIssue8611()
- # Even in C locale
+ # Use C locale to get ascii for the locale encoding
env = os.environ.copy()
- env['LANG'] = 'C'
+ env['LC_ALL'] = 'C'
try:
del env['PYTHONFSENCODING']
except KeyError: