From: Antoine Pitrou Date: Wed, 25 May 2011 16:17:25 +0000 (+0200) Subject: Issue #12045: Avoid duplicate execution of command in ctypes.util._get_soname(). X-Git-Tag: v3.3.0a1~2183^2~103^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b46004c94f59af1adc081d2a89d9e3f73998ee59;p=python Issue #12045: Avoid duplicate execution of command in ctypes.util._get_soname(). Patch by Sijin Joseph. --- diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index e4c204da9e..6815f941d5 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -137,9 +137,7 @@ elif os.name == "posix": rv = f.close() if rv == 10: raise OSError('objdump command not found') - with contextlib.closing(os.popen(cmd)) as f: - data = f.read() - res = re.search(r'\sSONAME\s+([^\s]+)', data) + res = re.search(r'\sSONAME\s+([^\s]+)', dump) if not res: return None return res.group(1) diff --git a/Misc/NEWS b/Misc/NEWS index 36a3c9da18..cba2d50cda 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -161,6 +161,9 @@ Core and Builtins Library ------- +- Issue #12045: Avoid duplicate execution of command in ctypes.util._get_soname(). + Patch by Sijin Joseph. + - Issue #10818: Remove the Tk GUI and the serve() function of the pydoc module, pydoc -g has been deprecated in Python 3.2 and it has a new enhanced web server.