Kaydet (Commit) 89f3ad10 authored tarafından Victor Stinner's avatar Victor Stinner

test_subprocess doesn't need to C locale to test os.environb

Improve also the comment to explain why C locale is needed to test os.environ.
üst ebc78d23
...@@ -885,7 +885,9 @@ class POSIXProcessTestCase(BaseTestCase): ...@@ -885,7 +885,9 @@ class POSIXProcessTestCase(BaseTestCase):
script = "import os; print(ascii(os.getenv(%s)))" % repr(key) script = "import os; print(ascii(os.getenv(%s)))" % repr(key)
env = os.environ.copy() env = os.environ.copy()
env[key] = value env[key] = value
# Use C locale to get ascii for the locale encoding # Use C locale to get ascii for the locale encoding to force
# surrogate-escaping of \xFF in the child process; otherwise it can
# be decoded as-is if the default locale is latin-1.
env['LC_ALL'] = 'C' env['LC_ALL'] = 'C'
stdout = subprocess.check_output( stdout = subprocess.check_output(
[sys.executable, "-c", script], [sys.executable, "-c", script],
...@@ -899,8 +901,6 @@ class POSIXProcessTestCase(BaseTestCase): ...@@ -899,8 +901,6 @@ class POSIXProcessTestCase(BaseTestCase):
script = "import os; print(ascii(os.getenvb(%s)))" % repr(key) script = "import os; print(ascii(os.getenvb(%s)))" % repr(key)
env = os.environ.copy() env = os.environ.copy()
env[key] = value env[key] = value
# Use C locale to get ascii for the locale encoding
env['LC_ALL'] = 'C'
stdout = subprocess.check_output( stdout = subprocess.check_output(
[sys.executable, "-c", script], [sys.executable, "-c", script],
env=env) env=env)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment