diff options
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r-- | Lib/urllib2.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 9e95fda..9c773fc 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -293,6 +293,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"]: |