diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-10-18 07:08:27 +0000 |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-10-18 07:08:27 +0000 |
commit | c1bde6e14dd03b40f11fd3481eb7c40247e27a4d (patch) | |
tree | 919986d71f02b403c21312b6a47fb715d3542fb5 | |
parent | e8e9cf4f8d44d492c57b28261fe651b091125086 (diff) | |
download | cpython-git-c1bde6e14dd03b40f11fd3481eb7c40247e27a4d.tar.gz |
Merged revisions 75482 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75482 | ronald.oussoren | 2009-10-18 09:07:00 +0200 (Sun, 18 Oct 2009) | 3 lines
Fix for issue 7149: a regression in 2.6.3 that causes an exception when
trying to detect proxy settings on OSX.
........
-rw-r--r-- | Lib/urllib.py | 11 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index a5c8fa241c..1ae08a0be4 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -1344,6 +1344,8 @@ if sys.platform == 'darwin': import socket from fnmatch import fnmatch + hostonly, port = splitport(host) + def ip2num(ipAddr): parts = ipAddr.split('.') parts = map(int, parts) @@ -1358,6 +1360,8 @@ if sys.platform == 'darwin': if proxy_settings['exclude_simple']: return True + hostIP = None + for value in proxy_settings.get('exceptions', ()): # Items in the list are strings like these: *.local, 169.254/16 if not value: continue @@ -1365,8 +1369,11 @@ if sys.platform == 'darwin': m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value) if m is not None: if hostIP is None: - hostIP = socket.gethostbyname(host) - hostIP = ip2num(hostIP) + try: + hostIP = socket.gethostbyname(hostonly) + hostIP = ip2num(hostIP) + except socket.error: + continue base = ip2num(m.group(1)) mask = int(m.group(2)[1:]) @@ -18,6 +18,8 @@ Core and Builtins Library ------- +- Issue #7149: fix exception in urllib when detecting proxy settings on OSX. + - Issue #7120: logging: Removed import of multiprocessing which is causing crash in GAE. |