From ca7f8b8f3150ad80e8a0de97e0b6f53df944e3d9 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 26 Aug 2022 06:07:47 +0530 Subject: [PATCH] Bugfix for 822d66e591341f8bf082be371b4beb66d72ba080 Closes #4760 --- yt_dlp/options.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/options.py b/yt_dlp/options.py index 50bba9b63..a0db9bc02 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -164,6 +164,7 @@ def format_option_strings(option): class _YoutubeDLOptionParser(optparse.OptionParser): # optparse is deprecated since python 3.2. So assume a stable interface even for private methods + ALIAS_DEST = '_triggered_aliases' ALIAS_TRIGGER_LIMIT = 100 def __init__(self): @@ -175,6 +176,7 @@ def __init__(self): formatter=_YoutubeDLHelpFormatter(), conflict_handler='resolve', ) + self.set_default(self.ALIAS_DEST, collections.defaultdict(int)) _UNKNOWN_OPTION = (optparse.BadOptionError, optparse.AmbiguousOptionError) _BAD_OPTION = optparse.OptionValueError @@ -290,11 +292,9 @@ def _create_alias(option, opt_str, value, parser): parser.add_option_group(alias_group) aliases = (x if x.startswith('-') else f'--{x}' for x in map(str.strip, aliases.split(','))) - DEST = '_triggered_aliases' - setattr(parser.values, DEST, collections.defaultdict(int)) try: alias_group.add_option( - *aliases, help=opts, nargs=nargs, dest=DEST, type='str' if nargs else None, + *aliases, help=opts, nargs=nargs, dest=parser.ALIAS_DEST, type='str' if nargs else None, metavar=' '.join(f'ARG{i}' for i in range(nargs)), action='callback', callback=_alias_callback, callback_kwargs={'opts': opts, 'nargs': nargs}) except Exception as err: