aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_cmd_line.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-09-17 17:19:26 -0700
committerGitHub <noreply@github.com>2018-09-17 17:19:26 -0700
commitdbdee0073cf0b88fe541980ace1f650900f455cc (patch)
tree68551d58bdbdf451a11dbb462ff65d0c3fac1368 /Lib/test/test_cmd_line.py
parent7a0791b6992d420dc52536257f2f093851ed7215 (diff)
downloadcpython-dbdee0073cf0b88fe541980ace1f650900f455cc.tar.gz
cpython-dbdee0073cf0b88fe541980ace1f650900f455cc.zip
bpo-34589: Add -X coerce_c_locale command line option (GH-9378)
Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538).
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r--Lib/test/test_cmd_line.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 21511b896ca..7e967b20ab8 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -159,13 +159,16 @@ class CmdLineTest(unittest.TestCase):
env = os.environ.copy()
# Use C locale to get ascii for the locale encoding
env['LC_ALL'] = 'C'
- env['PYTHONCOERCECLOCALE'] = '0'
code = (
b'import locale; '
b'print(ascii("' + undecodable + b'"), '
b'locale.getpreferredencoding())')
p = subprocess.Popen(
- [sys.executable, "-c", code],
+ [sys.executable,
+ # Disable C locale coercion and UTF-8 Mode to not use UTF-8
+ "-X", "coerce_c_locale=0",
+ "-X", "utf8=0",
+ "-c", code],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=env)
stdout, stderr = p.communicate()