[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 1f74b9e933)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2023-06-27 20:41:36 -07:00 committed by GitHub
parent c1c6738526
commit 0373c2ccd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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