File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -511,9 +511,6 @@ def build_opener(*handlers):
511511 If any of the handlers passed as arguments are subclasses of the
512512 default handlers, the default handlers will not be used.
513513 """
514- def isclass (obj ):
515- return isinstance (obj , type ) or hasattr (obj , "__bases__" )
516-
517514 opener = OpenerDirector ()
518515 default_classes = [ProxyHandler , UnknownHandler , HTTPHandler ,
519516 HTTPDefaultErrorHandler , HTTPRedirectHandler ,
@@ -524,7 +521,7 @@ def isclass(obj):
524521 skip = set ()
525522 for klass in default_classes :
526523 for check in handlers :
527- if isclass (check ):
524+ if instance (check , type ):
528525 if issubclass (check , klass ):
529526 skip .add (klass )
530527 elif isinstance (check , klass ):
@@ -536,7 +533,7 @@ def isclass(obj):
536533 opener .add_handler (klass ())
537534
538535 for h in handlers :
539- if isclass ( h ):
536+ if isinstance ( h , type ):
540537 h = h ()
541538 opener .add_handler (h )
542539 return opener
You can’t perform that action at this time.
0 commit comments