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).
This commit is contained in:
Victor Stinner 2018-09-17 17:19:26 -07:00 committed by GitHub
parent 7a0791b699
commit dbdee0073c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 160 additions and 52 deletions

View file

@ -656,9 +656,8 @@ class SysModuleTest(unittest.TestCase):
def c_locale_get_error_handler(self, locale, isolated=False, encoding=None):
# Force the POSIX locale
env = os.environ.copy()
env = dict(os.environ)
env["LC_ALL"] = locale
env["PYTHONCOERCECLOCALE"] = "0"
code = '\n'.join((
'import sys',
'def dump(name):',
@ -668,7 +667,10 @@ class SysModuleTest(unittest.TestCase):
'dump("stdout")',
'dump("stderr")',
))
args = [sys.executable, "-X", "utf8=0", "-c", code]
args = [sys.executable,
"-X", "utf8=0",
"-X", "coerce_c_locale=0",
"-c", code]
if isolated:
args.append("-I")
if encoding is not None: