Fix for issue 7149: a regression in 2.6.3 that causes an exception when
trying to detect proxy settings on OSX.
This commit is contained in:
parent
9039b83c53
commit
31802d093f
|
@ -1340,6 +1340,8 @@ if sys.platform == 'darwin':
|
||||||
import socket
|
import socket
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
|
||||||
|
hostonly, port = splitport(host)
|
||||||
|
|
||||||
def ip2num(ipAddr):
|
def ip2num(ipAddr):
|
||||||
parts = ipAddr.split('.')
|
parts = ipAddr.split('.')
|
||||||
parts = map(int, parts)
|
parts = map(int, parts)
|
||||||
|
@ -1354,6 +1356,8 @@ if sys.platform == 'darwin':
|
||||||
if proxy_settings['exclude_simple']:
|
if proxy_settings['exclude_simple']:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
hostIP = None
|
||||||
|
|
||||||
for value in proxy_settings.get('exceptions', ()):
|
for value in proxy_settings.get('exceptions', ()):
|
||||||
# Items in the list are strings like these: *.local, 169.254/16
|
# Items in the list are strings like these: *.local, 169.254/16
|
||||||
if not value: continue
|
if not value: continue
|
||||||
|
@ -1361,8 +1365,11 @@ if sys.platform == 'darwin':
|
||||||
m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value)
|
m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
if hostIP is None:
|
if hostIP is None:
|
||||||
hostIP = socket.gethostbyname(host)
|
try:
|
||||||
|
hostIP = socket.gethostbyname(hostonly)
|
||||||
hostIP = ip2num(hostIP)
|
hostIP = ip2num(hostIP)
|
||||||
|
except socket.error:
|
||||||
|
continue
|
||||||
|
|
||||||
base = ip2num(m.group(1))
|
base = ip2num(m.group(1))
|
||||||
mask = int(m.group(2)[1:])
|
mask = int(m.group(2)[1:])
|
||||||
|
|
|
@ -411,6 +411,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7149: urllib fails on OSX in the proxy detection code
|
||||||
|
|
||||||
- Issue #7069: Make inspect.isabstract() return a boolean.
|
- Issue #7069: Make inspect.isabstract() return a boolean.
|
||||||
|
|
||||||
- Add support to the `ihooks` module for relative imports.
|
- Add support to the `ihooks` module for relative imports.
|
||||||
|
|
Loading…
Reference in New Issue