Kaydet (Commit) 1889623e authored tarafından Nick Coghlan's avatar Nick Coghlan

Issue #19734: ctypes resource management fixes

üst 878d258a
......@@ -132,7 +132,9 @@ elif os.name == "posix":
cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \
"objdump -p -j .dynamic 2>/dev/null " + f
f = os.popen(cmd)
try:
dump = f.read()
finally:
rv = f.close()
if rv == 10:
raise OSError('objdump command not found')
......@@ -176,7 +178,8 @@ elif os.name == "posix":
else:
cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
for line in os.popen(cmd).readlines():
with contextlib.closing(os.popen(cmd)) as f:
for line in f.readlines():
line = line.strip()
if line.startswith('Default Library Path (ELF):'):
paths = line.split()[4]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment