1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-16 14:27:53 +00:00

[compat] correct OptionGroup invocation for Python 3 (fixes #4243)

This commit is contained in:
Philipp Hagemeister 2014-11-20 07:21:12 +01:00
parent e07e931375
commit 07e378fa18

View File

@ -302,9 +302,11 @@ else:
# Fix https://github.com/rg3/youtube-dl/issues/4223 # Fix https://github.com/rg3/youtube-dl/issues/4223
# See http://bugs.python.org/issue9161 for what is broken # See http://bugs.python.org/issue9161 for what is broken
def workaround_optparse_bug9161(): def workaround_optparse_bug9161():
op = optparse.OptionParser()
og = optparse.OptionGroup(op, 'foo')
try: try:
optparse.OptionGroup('foo').add_option('-t') og.add_option('-t')
except TypeError: except TypeError as te:
real_add_option = optparse.OptionGroup.add_option real_add_option = optparse.OptionGroup.add_option
def _compat_add_option(self, *args, **kwargs): def _compat_add_option(self, *args, **kwargs):