X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fcompat.py;h=385924803f0fed16e62227a14c717486068690b2;hb=8caa0c97799dda29fff7d0b0e717e09beee851d3;hp=b3752634a08a5982e52353be0ba272b6aba1f202;hpb=451948b28c4c520e3146d36b6ffb3079449f22e1;p=youtube-dl diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py index b3752634a..385924803 100644 --- a/youtube_dl/compat.py +++ b/youtube_dl/compat.py @@ -288,6 +288,14 @@ if sys.version_info < (3, 0) and sys.platform == 'win32': 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 @@ __all__ = [ 'compat_html_entities', 'compat_html_parser', 'compat_http_client', + 'compat_kwargs', 'compat_ord', 'compat_parse_qs', 'compat_print',