summaryrefslogtreecommitdiffstats
path: root/Lib/uuid.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-26 20:49:36 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-26 20:49:36 (GMT)
commit822963ed5d6150f901979fe9d61ef9026e4787a5 (patch)
tree3a749250e95cd0b8ae490a332daaea4289629d7e /Lib/uuid.py
parent518e6ee98b6d5a231ff9fcc603a92d15e962ba19 (diff)
parent56507c7862b6e2de189b6a942f394efb676cdb0b (diff)
downloadcpython-822963ed5d6150f901979fe9d61ef9026e4787a5.zip
cpython-822963ed5d6150f901979fe9d61ef9026e4787a5.tar.gz
cpython-822963ed5d6150f901979fe9d61ef9026e4787a5.tar.bz2
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 93254ec..385fb9b 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 OSError:
continue
return None