Patch #1752270, #1750931: complain if urllib2 add_handler called
without handler.
(backport from rev. 56293)
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 09d7f9c..3578e7a 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -298,6 +298,10 @@
self.process_request = {}
def add_handler(self, handler):
+ if not hasattr(handler, "add_parent"):
+ raise TypeError("expected BaseHandler instance, got %r" %
+ type(handler))
+
added = False
for meth in dir(handler):
if meth in ["redirect_request", "do_open", "proxy_open"]: