diff --git a/test/test_niconico_downloader.py b/test/test_niconico_downloader.py new file mode 100644 index 000000000..df93067fb --- /dev/null +++ b/test/test_niconico_downloader.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# coding: utf-8 +from __future__ import unicode_literals + +import subprocess +import sys +import unittest + + +class TestNiconicoDownloader(unittest.TestCase): + def test_no_syntax_warning_return_in_finally(self): + """Issue #33243: 'return' in a 'finally' block triggers SyntaxWarning in Python 3.14+""" + result = subprocess.run( + [sys.executable, '-W', 'error::SyntaxWarning', '-c', + 'from youtube_dl.downloader.niconico import NiconicoDmcFD'], + capture_output=True, text=True) + self.assertEqual( + result.returncode, 0, + 'Importing niconico downloader raised SyntaxWarning ' + '(return in finally block):\n' + result.stderr) + + +if __name__ == '__main__': + unittest.main() diff --git a/youtube_dl/downloader/niconico.py b/youtube_dl/downloader/niconico.py index 6392c9989..2240febf8 100644 --- a/youtube_dl/downloader/niconico.py +++ b/youtube_dl/downloader/niconico.py @@ -63,4 +63,4 @@ class NiconicoDmcFD(FileDownloader): with heartbeat_lock: timer[0].cancel() download_complete = True - return success + return success