From: Victor Stinner Date: Wed, 28 Jun 2023 02:50:51 +0000 (+0200) Subject: Fix c-analyzer for GCC: ignore LANG env var (#106173) X-Git-Tag: v3.13.0a1~1619 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f74b9e933d546a015e8497e3b8728357196acc8;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Tools/c-analyzer/c_parser/preprocessor/common.py b/Tools/c-analyzer/c_parser/preprocessor/common.py index dbe1edeef385..06f8f4da62b2 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