[issue32498] urllib.parse.unquote raises incorrect errormessage when string parameter is bytes

stein-k report at bugs.python.org
Sat Jan 6 13:39:07 EST 2018


stein-k <karlsen.stein at gmail.com> added the comment:

The message is incorrect for the input to the function, and confusing because the caller did supply a bytes-like object.

The exception is from an implementation detail, and if the implementation changes the exception could as well. 

I suggest the implementation is changed to follow the example of  urllib.parse.unquote_to_bytes, which encodes its string parameter to bytes if it receives a str object.

Alternatively, a check for required type should be implemented and raise a TypeError with the correct error-message.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32498>
_______________________________________


More information about the Python-bugs-list mailing list