[Python-checkins] cpython (merge 3.4 -> default): Issue #19720: Suppressed context for some exceptions in importlib.

serhiy.storchaka python-checkins at python.org
Fri Nov 21 21:00:08 CET 2014


https://hg.python.org/cpython/rev/8f77f7bb46c7
changeset:   93532:8f77f7bb46c7
parent:      93529:2de3c659a979
parent:      93531:97ceab0bd6f8
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Nov 21 21:56:57 2014 +0200
summary:
  Issue #19720: Suppressed context for some exceptions in importlib.

files:
  Lib/uuid.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/uuid.py b/Lib/uuid.py
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -359,7 +359,10 @@
 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', [os.fsencode(ip_addr)], lambda i: -1)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list