[Python-checkins] cpython (merge 3.4 -> default): merge 3.4

benjamin.peterson python-checkins at python.org
Tue Apr 1 20:21:12 CEST 2014


http://hg.python.org/cpython/rev/72da7e4af99e
changeset:   90091:72da7e4af99e
parent:      90089:2c7ebb930b64
parent:      90090:abb85902ce79
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Apr 01 14:21:03 2014 -0400
summary:
  merge 3.4

files:
  Lib/urllib/request.py |  7 ++-----
  1 files changed, 2 insertions(+), 5 deletions(-)


diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -511,9 +511,6 @@
     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 @@
     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 @@
         opener.add_handler(klass())
 
     for h in handlers:
-        if isclass(h):
+        if isinstance(h, type):
             h = h()
         opener.add_handler(h)
     return opener

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list