Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef6ff66

Browse files
author
Victor Stinner
committed
Fix test_sys: set LC_ALL instead of LANG
LC_ALL is read before LANG to choose the locale encoding (LC_ALL, LANG and then LC_CTYPE: use the first non empty variable).
1 parent 112c0f3 commit ef6ff66

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/test/test_sys.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ def test_undecodable_code(self):
507507

508508
undecodable = b"\xff"
509509
env = os.environ.copy()
510-
env['LANG'] = 'C'
510+
# Use C locale to get ascii for the locale encoding
511+
env['LC_ALL'] = 'C'
511512
code = (
512513
b'import locale; '
513514
b'print(ascii("' + undecodable + b'"), '
@@ -614,9 +615,9 @@ def get_fsencoding(env):
614615
# Raise SkipTest() if sys.executable is not encodable to ascii
615616
test.support.workaroundIssue8611()
616617

617-
# Even in C locale
618+
# Use C locale to get ascii for the locale encoding
618619
env = os.environ.copy()
619-
env['LANG'] = 'C'
620+
env['LC_ALL'] = 'C'
620621
try:
621622
del env['PYTHONFSENCODING']
622623
except KeyError:

0 commit comments

Comments
 (0)