]> granicus.if.org Git - python/commitdiff
Fix for Issue8883: without this patch test_urllib will fail
authorRonald Oussoren <ronaldoussoren@mac.com>
Sun, 27 Jun 2010 13:59:39 +0000 (13:59 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Sun, 27 Jun 2010 13:59:39 +0000 (13:59 +0000)
when there is a bare IP address in the "Bypass proxy settings
for these Hosts & Domains" list on MacOSX.

Lib/urllib.py

index de67f6721d1c395afe88cd5f2813c28aa2650fc2..707e2f0c65f07345efb0680006574de6c135a4c5 100644 (file)
@@ -1383,8 +1383,13 @@ if sys.platform == 'darwin':
                         continue
 
                 base = ip2num(m.group(1))
-                mask = int(m.group(2)[1:])
-                mask = 32 - mask
+                mask = m.group(2)
+                if mask is None:
+                    mask = 8 * (m.group(1).count('.') + 1)
+
+                else:
+                    mask = int(mask[1:])
+                    mask = 32 - mask
 
                 if (hostIP >> mask) == (base >> mask):
                     return True