Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Backport of r62463.
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 3578e7a..50d7aaf 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -447,14 +447,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)