aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/compat.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-11-20 07:21:12 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-11-20 07:21:12 +0100
commit07e378fa18b1c6b8becd46f6cf2d476e29a70a59 (patch)
tree9373cc6ebc4d78db9c5d668febd2b5f970ccafd2 /youtube_dl/compat.py
parente07e931375df3984e4f92610413a2f52764bf432 (diff)
[compat] correct OptionGroup invocation for Python 3 (fixes #4243)
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r--youtube_dl/compat.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index 64a975489..adf81e7ab 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -302,9 +302,11 @@ else:
# Fix https://github.com/rg3/youtube-dl/issues/4223
# See http://bugs.python.org/issue9161 for what is broken
def workaround_optparse_bug9161():
+ op = optparse.OptionParser()
+ og = optparse.OptionGroup(op, 'foo')
try:
- optparse.OptionGroup('foo').add_option('-t')
- except TypeError:
+ og.add_option('-t')
+ except TypeError as te:
real_add_option = optparse.OptionGroup.add_option
def _compat_add_option(self, *args, **kwargs):