mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
Silence the BytesWarning, due to patch r83294 for #9301
This commit is contained in:
parent
ac521078d7
commit
82a3f8afcb
1 changed files with 3 additions and 1 deletions
|
@ -314,7 +314,9 @@ def unquote_to_bytes(string):
|
|||
"""unquote_to_bytes('abc%20def') -> b'abc def'."""
|
||||
# Note: strings are encoded as UTF-8. This is only an issue if it contains
|
||||
# unescaped non-ASCII characters, which URIs should not.
|
||||
if string in (b'', ''):
|
||||
if not string:
|
||||
# Is it a string-like object?
|
||||
string.split
|
||||
return b''
|
||||
if isinstance(string, str):
|
||||
string = string.encode('utf-8')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue