summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-01 18:20:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-04-01 18:20:56 (GMT)
commit5dd3caed2be6da5df934c7c3bedf0bd9ba2d4bf6 (patch)
treeeed7d7ee6eb6639e76aa52c0efaa9d77774f2e94 /Lib
parent9d08562ed43fee1738a8ef8b07e52598399cc1be (diff)
downloadcpython-5dd3caed2be6da5df934c7c3bedf0bd9ba2d4bf6.zip
cpython-5dd3caed2be6da5df934c7c3bedf0bd9ba2d4bf6.tar.gz
cpython-5dd3caed2be6da5df934c7c3bedf0bd9ba2d4bf6.tar.bz2
simplify check, since now there are only new-style classes
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib/request.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 5995cbe..65a3aeb 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -511,9 +511,6 @@ def build_opener(*handlers):
If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not be used.
"""
- def isclass(obj):
- return isinstance(obj, type) or hasattr(obj, "__bases__")
-
opener = OpenerDirector()
default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
HTTPDefaultErrorHandler, HTTPRedirectHandler,
@@ -524,7 +521,7 @@ def build_opener(*handlers):
skip = set()
for klass in default_classes:
for check in handlers:
- if isclass(check):
+ if instance(check, type):
if issubclass(check, klass):
skip.add(klass)
elif isinstance(check, klass):
@@ -536,7 +533,7 @@ def build_opener(*handlers):
opener.add_handler(klass())
for h in handlers:
- if isclass(h):
+ if isinstance(h, type):
h = h()
opener.add_handler(h)
return opener