diff --git a/build_tools/marshal.py b/build_tools/marshal.py index 18afe2ca52..4a1522f0b8 100644 --- a/build_tools/marshal.py +++ b/build_tools/marshal.py @@ -48,6 +48,7 @@ interpretters, and so the exact same interpretter should be used both to run this script, and to read in and execute the marshalled code later. """ +import locale import marshal import sys import zlib @@ -65,6 +66,11 @@ if len(sys.argv) < 4: print(f"Usage: {sys.argv[0]} CPP PY MODPATH ABSPATH", file=sys.stderr) sys.exit(1) +# Set the Python's locale settings manually based on the `LC_CTYPE` +# environment variable +if "LC_CTYPE" in os.environ: + locale.setlocale(locale.LC_CTYPE, os.environ["LC_CTYPE"]) + _, cpp, python, modpath, abspath = sys.argv with open(python, "r") as f: diff --git a/site_scons/gem5_scons/defaults.py b/site_scons/gem5_scons/defaults.py index a07b7ffa4b..996cfd495f 100644 --- a/site_scons/gem5_scons/defaults.py +++ b/site_scons/gem5_scons/defaults.py @@ -66,6 +66,7 @@ def EnvDefaults(env): "GEM5PY_LINKFLAGS_EXTRA", "LINKFLAGS_EXTRA", "LANG", + "LC_CTYPE", ] )