[Python-checkins] r82284 - python/trunk/Lib/urllib.py

ronald.oussoren python-checkins at python.org
Sun Jun 27 15:59:39 CEST 2010


Author: ronald.oussoren
Date: Sun Jun 27 15:59:39 2010
New Revision: 82284

Log:
Fix for Issue8883: without this patch test_urllib will fail
when there is a bare IP address in the "Bypass proxy settings
for these Hosts & Domains" list on MacOSX.


Modified:
   python/trunk/Lib/urllib.py

Modified: python/trunk/Lib/urllib.py
==============================================================================
--- python/trunk/Lib/urllib.py	(original)
+++ python/trunk/Lib/urllib.py	Sun Jun 27 15:59:39 2010
@@ -1383,8 +1383,13 @@
                         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


More information about the Python-checkins mailing list