Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index a20e552..817c5a7 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -446,14 +446,14 @@
FTPHandler, FileHandler, HTTPErrorProcessor]
if hasattr(httplib, 'HTTPS'):
default_classes.append(HTTPSHandler)
- skip = []
+ skip = set()
for klass in default_classes:
for check in handlers:
if isclass(check):
if issubclass(check, klass):
- skip.append(klass)
+ skip.add(klass)
elif isinstance(check, klass):
- skip.append(klass)
+ skip.add(klass)
for klass in skip:
default_classes.remove(klass)