Skip to content

Commit

Permalink
Fix c-analyzer for GCC: ignore LANG env var (#106173)
Browse files Browse the repository at this point in the history
The c-analyzer doesn't support GCC localized messages, so just unset
the LANG environment variable.
  • Loading branch information
vstinner authored and pull[bot] committed Dec 12, 2023
1 parent 984ee0b commit 1407531
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 1407531

Please sign in to comment.