Skip to content

Commit 62b4c35

Browse files
committed
allow mixed string type inputs to misc urllib.parse.* functions
...eg urlparse, urlunparse, urlsplit, urlunsplit, urljoin, urldefrag, and parse_qsl. fixes #273. the original bug result in this kind of exception: ``` Traceback (most recent call last): ... File ".../future/backports/urllib/parse.py", line 387, in urlunparse _coerce_args(*components)) File ".../future/backports/urllib/parse.py", line 115, in _coerce_args raise TypeError("Cannot mix str and non-str arguments") TypeError: Cannot mix str and non-str arguments ```
1 parent fdd5eeb commit 62b4c35

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/future/backports/urllib/parse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def _coerce_args(*args):
107107
# an appropriate result coercion function
108108
# - noop for str inputs
109109
# - encoding function otherwise
110-
str_input = isinstance(args[0], str)
110+
str_input = isinstance(args[0], basestring)
111111
for arg in args[1:]:
112112
# We special-case the empty string to support the
113113
# "scheme=''" default argument to some functions
114-
if arg and isinstance(arg, str) != str_input:
114+
if arg and isinstance(arg, basestring) != str_input:
115115
raise TypeError("Cannot mix str and non-str arguments")
116116
if str_input:
117117
return args + (_noop,)

0 commit comments

Comments
 (0)