projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab953c6
)
[utils] Do not fail in int_or_none on non-numeric data (Closes #7175)
author
Sergey M․
<dstftw@gmail.com>
Wed, 14 Oct 2015 16:35:01 +0000
(22:35 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Wed, 14 Oct 2015 16:35:01 +0000
(22:35 +0600)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 1dc3153fd901e8fef6241e747f863a52a221e12d..86c693358539451efc6fe4253382ff60427349c6 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-1371,7
+1371,12
@@
def int_or_none(v, scale=1, default=None, get_attr=None, invscale=1):
v = getattr(v, get_attr, None)
if v == '':
v = None
- return default if v is None else (int(v) * invscale // scale)
+ if v is None:
+ return default
+ try:
+ return int(v) * invscale // scale
+ except ValueError:
+ pass
def str_or_none(v, default=None):