diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-06 22:17:24 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-06 22:17:24 +0300 |
commit | c70386ec16c373dc3c2b2778f12f1772985bd304 (patch) | |
tree | 544a1e62bb3cbaaa00324d30d5269ebefdf9cf66 /Lib/uuid.py | |
parent | Issue #19524: Fixed resource leak in the HTTP connection when an invalid (diff) | |
download | cpython-c70386ec16c373dc3c2b2778f12f1772985bd304.tar.gz cpython-c70386ec16c373dc3c2b2778f12f1772985bd304.tar.bz2 cpython-c70386ec16c373dc3c2b2778f12f1772985bd304.zip |
Issue #22131: Fixed a bug in handling an error occured during reading from
a pipe in _ipconfig_getnode().
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r-- | Lib/uuid.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py index a4e553247d9..90f36ab1bc2 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -383,13 +383,11 @@ def _ipconfig_getnode(): pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all') except OSError: continue - else: + with pipe: for line in pipe: value = line.split(':')[-1].strip().lower() if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value): return int(value.replace('-', ''), 16) - finally: - pipe.close() def _netbios_getnode(): """Get the hardware address on Windows using NetBIOS calls. |