From 0373c2ccd5f60dd7b6435879e2f8c1b9ed879a3a Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:41:36 -0700 Subject: [3.12] Fix c-analyzer for GCC: ignore LANG env var (GH-106173) (#106178) Fix c-analyzer for GCC: ignore LANG env var (GH-106173) The c-analyzer doesn't support GCC localized messages, so just unset the LANG environment variable. (cherry picked from commit 1f74b9e933d546a015e8497e3b8728357196acc8) Co-authored-by: Victor Stinner --- Tools/c-analyzer/c_parser/preprocessor/common.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v0.12