mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class. Backport of r62463.
This commit is contained in:
parent
f305bd3ea2
commit
8d904c3981
3 changed files with 12 additions and 3 deletions
|
|
@ -1038,6 +1038,12 @@ class MiscTests(unittest.TestCase):
|
|||
o = build_opener(urllib2.HTTPHandler())
|
||||
self.opener_has_handler(o, urllib2.HTTPHandler)
|
||||
|
||||
# Issue2670: multiple handlers sharing the same base class
|
||||
class MyOtherHTTPHandler(urllib2.HTTPHandler): pass
|
||||
o = build_opener(MyHTTPHandler, MyOtherHTTPHandler)
|
||||
self.opener_has_handler(o, MyHTTPHandler)
|
||||
self.opener_has_handler(o, MyOtherHTTPHandler)
|
||||
|
||||
def opener_has_handler(self, opener, handler_class):
|
||||
for h in opener.handlers:
|
||||
if h.__class__ == handler_class:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue