(original) (raw)
changeset: 92370:8a61a287776d branch: 3.4 parent: 92366:c1fb19907cc4 user: Serhiy Storchaka storchaka@gmail.com date: Sat Sep 06 22:17:24 2014 +0300 files: Lib/uuid.py description: Issue #22131: Fixed a bug in handling an error occured during reading from a pipe in _ipconfig_getnode(). diff -r c1fb19907cc4 -r 8a61a287776d Lib/uuid.py --- a/Lib/uuid.py Sat Sep 06 21:41:39 2014 +0300 +++ b/Lib/uuid.py Sat Sep 06 22:17:24 2014 +0300 @@ -383,13 +383,11 @@ 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. /storchaka@gmail.com