mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class. Backport of r62463.
This commit is contained in:
parent
f305bd3ea2
commit
8d904c3981
3 changed files with 12 additions and 3 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue