diff options
author | Éric Araujo <merwok@netwok.org> | 2010-11-06 15:57:52 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2010-11-06 15:57:52 (GMT) |
commit | 8bdbe9c52f95eb161a14e9571562892abd450ae0 (patch) | |
tree | 687373c931ba5c22894ce80d503dcf1b33e991ad /Lib/distutils | |
parent | e7cf95424718443079159fedd5c1b487ac6a98b5 (diff) | |
download | cpython-8bdbe9c52f95eb161a14e9571562892abd450ae0.zip cpython-8bdbe9c52f95eb161a14e9571562892abd450ae0.tar.gz cpython-8bdbe9c52f95eb161a14e9571562892abd450ae0.tar.bz2 |
Correct the fix for #10252: Popen objects have no close method.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/cygwinccompiler.py | 4 | ||||
-rw-r--r-- | Lib/distutils/msvc9compiler.py | 31 |
2 files changed, 20 insertions, 15 deletions
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 95fa3ed..5676e91 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -377,7 +377,9 @@ def _find_exe_version(cmd): try: out_string = out.read() finally: - out.close() + out.stdin.close() + out.stdout.close() + out.stderr.close() result = RE_VERSION.search(out_string) if result is None: return None diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index 6d7825d..488524d 100644 --- a/Lib/distutils/msvc9compiler.py +++ b/Lib/distutils/msvc9compiler.py @@ -267,21 +267,24 @@ def query_vcvarsall(version, arch="x86"): stdout, stderr = popen.communicate() if popen.wait() != 0: raise DistutilsPlatformError(stderr.decode("mbcs")) + + stdout = stdout.decode("mbcs") + for line in stdout.split("\n"): + line = Reg.convert_mbcs(line) + if '=' not in line: + continue + line = line.strip() + key, value = line.split('=', 1) + key = key.lower() + if key in interesting: + if value.endswith(os.pathsep): + value = value[:-1] + result[key] = removeDuplicates(value) + finally: - popen.close() - - stdout = stdout.decode("mbcs") - for line in stdout.split("\n"): - line = Reg.convert_mbcs(line) - if '=' not in line: - continue - line = line.strip() - key, value = line.split('=', 1) - key = key.lower() - if key in interesting: - if value.endswith(os.pathsep): - value = value[:-1] - result[key] = removeDuplicates(value) + popen.stdin.close() + popen.stdout.close() + popen.stderr.close() if len(result) != len(interesting): raise ValueError(str(list(result.keys()))) |