summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/distutils/msvc9compiler.py15
-rw-r--r--Misc/NEWS4
2 files changed, 17 insertions, 2 deletions
diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
index fdb74ae..465013d 100644
--- a/Lib/distutils/msvc9compiler.py
+++ b/Lib/distutils/msvc9compiler.py
@@ -193,6 +193,17 @@ def normalize_and_reduce_paths(paths):
reduced_paths.append(np)
return reduced_paths
+def removeDuplicates(variable):
+ """Remove duplicate values of an environment variable.
+ """
+ oldList = variable.split(os.pathsep)
+ newList = []
+ for i in oldList:
+ if i not in newList:
+ newList.append(i)
+ newVariable = os.pathsep.join(newList)
+ return newVariable
+
def find_vcvarsall(version):
"""Find the vcvarsall.bat file
@@ -252,12 +263,12 @@ def query_vcvarsall(version, arch="x86"):
if '=' not in line:
continue
line = line.strip()
- key, value = line.split('=')
+ key, value = line.split('=', 1)
key = key.lower()
if key in interesting:
if value.endswith(os.pathsep):
value = value[:-1]
- result[key] = value
+ result[key] = removeDuplicates(value)
if len(result) != len(interesting):
raise ValueError(str(list(result.keys())))
diff --git a/Misc/NEWS b/Misc/NEWS
index d1be39c..355633d 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -74,6 +74,10 @@ Library
Extension Modules
-----------------
+- Issue #2975: When compiling several extension modules with Visual Studio 2008
+ from the same python interpreter, some environment variables would grow
+ without limit.
+
- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by
exploitation of poor argument checking.