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.
This commit is contained in:
Victor Stinner 2023-06-28 04:50:51 +02:00 committed by GitHub
parent adaacf26d3
commit 1f74b9e933
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