aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-26 22:47:16 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-26 22:47:16 +0200
commit56507c7862b6e2de189b6a942f394efb676cdb0b (patch)
tree5f81a187f15ef5c7c7f8810cbf8328b98cce432f /Lib/uuid.py
parentUse @bigmemtest more accurately. (diff)
downloadcpython-56507c7862b6e2de189b6a942f394efb676cdb0b.tar.gz
cpython-56507c7862b6e2de189b6a942f394efb676cdb0b.tar.bz2
cpython-56507c7862b6e2de189b6a942f394efb676cdb0b.zip
Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with
virtual interface. Original patch by Kent Frazier.
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r--Lib/uuid.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 9226fd4ebbe..d5c3160fdfd 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -327,8 +327,16 @@ def _find_mac(command, args, hw_identifiers, get_index):
words = line.lower().split()
for i in range(len(words)):
if words[i] in hw_identifiers:
- return int(
- words[get_index(i)].replace(':', ''), 16)
+ try:
+ return int(
+ words[get_index(i)].replace(':', ''), 16)
+ except (ValueError, IndexError):
+ # Virtual interfaces, such as those provided by
+ # VPNs, do not have a colon-delimited MAC address
+ # as expected, but a 16-byte HWAddr separated by
+ # dashes. These should be ignored in favor of a
+ # real MAC address
+ pass
except IOError:
continue
return None