Skip to content

Commit f5bc232

Browse files
Resolve BytesWarning
1 parent a34c412 commit f5bc232

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Lib/urllib/parse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,14 @@ def _coerce_args(*args):
124124
# - noop for str inputs
125125
# - encoding function otherwise
126126
str_input = None
127-
empty_values = {"", b"", None}
128127
for arg in args:
129128
if arg:
130129
if str_input is None:
131130
str_input = isinstance(arg, str)
132131
else:
133132
if isinstance(arg, str) != str_input:
134133
raise TypeError("Cannot mix str and non-str arguments")
135-
if arg is not None and str_input is False and not hasattr(arg, "decode"):
134+
if not hasattr(arg, "decode") and str_input is False:
136135
raise TypeError(f"Expected a string, bytes, or None: got {type(arg)}")
137136
elif arg is not None and not isinstance(arg, str) and not hasattr(arg, "decode"):
138137
warnings.warn(

0 commit comments

Comments
 (0)