0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-30 03:33:02 +00:00

[compat] Fix test_cmdline_umlauts on Python 2.6

The original statement raises uncaught UnicodeWarning on Python 2.6
This commit is contained in:
Yen Chi Hsuan 2016-07-07 22:30:58 +08:00
parent 5f87d845eb
commit ec3518725b
No known key found for this signature in database
GPG key ID: 3FDDD575826C5C30

View file

@ -2596,9 +2596,12 @@ def compat_shlex_quote(s):
try: try:
assert shlex.split('中文') == ['中文'] args = shlex.split('中文')
assert (isinstance(args, list) and
isinstance(args[0], compat_str) and
args[0] == '中文')
compat_shlex_split = shlex.split compat_shlex_split = shlex.split
except (AssertionError, UnicodeWarning, UnicodeEncodeError): except (AssertionError, UnicodeEncodeError):
# Working around shlex issue with unicode strings on some python 2 # Working around shlex issue with unicode strings on some python 2
# versions (see http://bugs.python.org/issue1548891) # versions (see http://bugs.python.org/issue1548891)
def compat_shlex_split(s, comments=False, posix=True): def compat_shlex_split(s, comments=False, posix=True):