diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-21 19:55:39 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-21 19:55:39 (GMT) |
commit | 525d5aeaaef40ad254da57a93b35a07ecb2bdb0b (patch) | |
tree | 07d70e67b48bde0b0a5d4c40ba3d8a1e5ab9a32e /Lib/uuid.py | |
parent | 5e63120f8d1593700f8d5813c535d318c8bab111 (diff) | |
download | cpython-525d5aeaaef40ad254da57a93b35a07ecb2bdb0b.zip cpython-525d5aeaaef40ad254da57a93b35a07ecb2bdb0b.tar.gz cpython-525d5aeaaef40ad254da57a93b35a07ecb2bdb0b.tar.bz2 |
Issue #17293: socket.gethostbyname() can raise an exception of FreeBSD.
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r-- | Lib/uuid.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py index 8321013..1061bff 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -361,7 +361,10 @@ def _ifconfig_getnode(): def _arp_getnode(): """Get the hardware address on Unix by running arp.""" import os, socket - ip_addr = socket.gethostbyname(socket.gethostname()) + try: + ip_addr = socket.gethostbyname(socket.gethostname()) + except OSError: + return None # Try getting the MAC addr from arp based on our IP address (Solaris). return _find_mac('arp', '-an', [ip_addr], lambda i: -1) |