summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-07-12 08:05:45 (GMT)
committerGeorg Brandl <georg@python.org>2007-07-12 08:05:45 (GMT)
commitf91149e4a194621b08346ce3f110712a174e271c (patch)
treed21757aed1764d8da0871f29b39662ff333f48f8 /Lib/urllib2.py
parentc6057c7812ac3dd05a80255b4750f606a0f79f81 (diff)
downloadcpython-f91149e4a194621b08346ce3f110712a174e271c.zip
cpython-f91149e4a194621b08346ce3f110712a174e271c.tar.gz
cpython-f91149e4a194621b08346ce3f110712a174e271c.tar.bz2
Patch #1752270, #1750931: complain if urllib2 add_handler called
without handler.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 415c991..b2cec72 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -295,6 +295,10 @@ class OpenerDirector:
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"]: