mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Correct the fix for #10252: Popen objects have no close method.
This commit is contained in:
parent
e7cf954247
commit
8bdbe9c52f
2 changed files with 20 additions and 15 deletions
|
@ -377,7 +377,9 @@ def _find_exe_version(cmd):
|
||||||
try:
|
try:
|
||||||
out_string = out.read()
|
out_string = out.read()
|
||||||
finally:
|
finally:
|
||||||
out.close()
|
out.stdin.close()
|
||||||
|
out.stdout.close()
|
||||||
|
out.stderr.close()
|
||||||
result = RE_VERSION.search(out_string)
|
result = RE_VERSION.search(out_string)
|
||||||
if result is None:
|
if result is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -267,21 +267,24 @@ def query_vcvarsall(version, arch="x86"):
|
||||||
stdout, stderr = popen.communicate()
|
stdout, stderr = popen.communicate()
|
||||||
if popen.wait() != 0:
|
if popen.wait() != 0:
|
||||||
raise DistutilsPlatformError(stderr.decode("mbcs"))
|
raise DistutilsPlatformError(stderr.decode("mbcs"))
|
||||||
finally:
|
|
||||||
popen.close()
|
|
||||||
|
|
||||||
stdout = stdout.decode("mbcs")
|
stdout = stdout.decode("mbcs")
|
||||||
for line in stdout.split("\n"):
|
for line in stdout.split("\n"):
|
||||||
line = Reg.convert_mbcs(line)
|
line = Reg.convert_mbcs(line)
|
||||||
if '=' not in line:
|
if '=' not in line:
|
||||||
continue
|
continue
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
key, value = line.split('=', 1)
|
key, value = line.split('=', 1)
|
||||||
key = key.lower()
|
key = key.lower()
|
||||||
if key in interesting:
|
if key in interesting:
|
||||||
if value.endswith(os.pathsep):
|
if value.endswith(os.pathsep):
|
||||||
value = value[:-1]
|
value = value[:-1]
|
||||||
result[key] = removeDuplicates(value)
|
result[key] = removeDuplicates(value)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
popen.stdin.close()
|
||||||
|
popen.stdout.close()
|
||||||
|
popen.stderr.close()
|
||||||
|
|
||||||
if len(result) != len(interesting):
|
if len(result) != len(interesting):
|
||||||
raise ValueError(str(list(result.keys())))
|
raise ValueError(str(list(result.keys())))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue