[utils] Disallow non string types in parse_duration (Closes #4679)
authorSergey M․ <dstftw@gmail.com>
Mon, 12 Jan 2015 15:06:26 +0000 (21:06 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 12 Jan 2015 15:06:26 +0000 (21:06 +0600)
youtube_dl/utils.py

index deaf718030f0f7f16e923dfe92d42a8d6ec1f53a..98732e8e99036b32eaa7b802a1ed028e85e0f7ae 100644 (file)
@@ -1269,7 +1269,7 @@ def float_or_none(v, scale=1, invscale=1, default=None):
 
 
 def parse_duration(s):
-    if s is None:
+    if not isinstance(s, basestring if sys.version_info < (3, 0) else compat_str):
         return None
 
     s = s.strip()