Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3704644

Browse files
author
Michael W. Hudson
committed
Use types.StringTypes instead of (types.StringType, types.UnicodeType) --
works better (at all!) in --disable-unicode builds. Bugfix candidate, probably.
1 parent 9c37306 commit 3704644

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/urllib2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def _call_chain(self, chain, kind, meth_name, *args):
303303

304304
def open(self, fullurl, data=None):
305305
# accept a URL or a Request object
306-
if isinstance(fullurl, (types.StringType, types.UnicodeType)):
306+
if isinstance(fullurl, types.StringTypes):
307307
req = Request(fullurl, data)
308308
else:
309309
req = fullurl
@@ -516,7 +516,7 @@ def __init__(self):
516516

517517
def add_password(self, realm, uri, user, passwd):
518518
# uri could be a single URI or a sequence
519-
if isinstance(uri, (types.StringType, types.UnicodeType)):
519+
if isinstance(uri, types.StringTypes):
520520
uri = [uri]
521521
uri = tuple(map(self.reduce_uri, uri))
522522
if not self.passwd.has_key(realm):

0 commit comments

Comments
 (0)