1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-18 07:05:41 +07:00

[compat] Work around kwargs bugs in old 2.6 Python releases (Fixes #3813)

This commit is contained in:
Philipp Hagemeister
2014-11-15 15:17:19 +01:00
parent a0155d93d9
commit c7b0add86f
2 changed files with 11 additions and 1 deletions

View File

@@ -288,6 +288,14 @@ def compat_getpass(prompt, *args, **kwargs):
else:
compat_getpass = getpass.getpass
# Old 2.6 and 2.7 releases require kwargs to be bytes
try:
(lambda x: x)(**{'x': 0})
except TypeError:
def compat_kwargs(kwargs):
return dict((bytes(k), v) for k, v in kwargs.items())
else:
compat_kwargs = lambda kwargs: kwargs
__all__ = [
'compat_HTTPError',
@@ -299,6 +307,7 @@ def compat_getpass(prompt, *args, **kwargs):
'compat_html_entities',
'compat_html_parser',
'compat_http_client',
'compat_kwargs',
'compat_ord',
'compat_parse_qs',
'compat_print',