diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-28 02:50:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 02:50:51 (GMT) |
commit | 1f74b9e933d546a015e8497e3b8728357196acc8 (patch) | |
tree | ee4c4b047157cdbc1c9ab61f040745137df597b2 | |
parent | adaacf26d3c407e311b453c71abc40672ee549df (diff) | |
download | cpython-1f74b9e933d546a015e8497e3b8728357196acc8.zip cpython-1f74b9e933d546a015e8497e3b8728357196acc8.tar.gz cpython-1f74b9e933d546a015e8497e3b8728357196acc8.tar.bz2 |
Fix c-analyzer for GCC: ignore LANG env var (#106173)
The c-analyzer doesn't support GCC localized messages, so just unset
the LANG environment variable.
-rw-r--r-- | Tools/c-analyzer/c_parser/preprocessor/common.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/common.py b/Tools/c-analyzer/c_parser/preprocessor/common.py index dbe1ede..06f8f4d 100644 --- a/Tools/c-analyzer/c_parser/preprocessor/common.py +++ b/Tools/c-analyzer/c_parser/preprocessor/common.py @@ -1,6 +1,7 @@ import contextlib import distutils.ccompiler import logging +import os import shlex import subprocess import sys @@ -40,7 +41,12 @@ def run_cmd(argv, *, kw.pop('kwargs') kwargs.update(kw) - proc = subprocess.run(argv, **kwargs) + # Remove LANG environment variable: the C parser doesn't support GCC + # localized messages + env = dict(os.environ) + env.pop('LANG', None) + + proc = subprocess.run(argv, env=env, **kwargs) return proc.stdout |