summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-28 03:41:36 (GMT)
committerGitHub <noreply@github.com>2023-06-28 03:41:36 (GMT)
commit0373c2ccd5f60dd7b6435879e2f8c1b9ed879a3a (patch)
treed811854628d3e4599b616157bcabdfcc794b8b88 /Tools
parentc1c6738526853c77c55b92ccd756aec96053677e (diff)
downloadcpython-0373c2ccd5f60dd7b6435879e2f8c1b9ed879a3a.zip
cpython-0373c2ccd5f60dd7b6435879e2f8c1b9ed879a3a.tar.gz
cpython-0373c2ccd5f60dd7b6435879e2f8c1b9ed879a3a.tar.bz2
[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 <vstinner@python.org>
Diffstat (limited to 'Tools')
-rw-r--r--Tools/c-analyzer/c_parser/preprocessor/common.py8
1 files changed, 7 insertions, 1 deletions
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