[Python-checkins] r84314 - python/branches/py3k/Lib/test/test_sys.py

victor.stinner python-checkins at python.org
Wed Aug 25 10:33:35 CEST 2010


Author: victor.stinner
Date: Wed Aug 25 10:33:34 2010
New Revision: 84314

Log:
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).


Modified:
   python/branches/py3k/Lib/test/test_sys.py

Modified: python/branches/py3k/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k/Lib/test/test_sys.py	(original)
+++ python/branches/py3k/Lib/test/test_sys.py	Wed Aug 25 10:33:34 2010
@@ -507,7 +507,8 @@
 
         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'"), '
@@ -614,9 +615,9 @@
         # 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:


More information about the Python-checkins mailing list