Issue #2670: urllib2.build_opener() failed when two handlers

derive the same default base class.

Backport of r62463.
This commit is contained in:
Amaury Forgeot d'Arc 2008-04-22 21:17:18 +00:00
parent f305bd3ea2
commit 8d904c3981
3 changed files with 12 additions and 3 deletions

View file

@ -447,14 +447,14 @@ def build_opener(*handlers):
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)