projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8197079
)
Revert "[jsinterp] Avoid double key lookup for setting new key"
author
Philipp Hagemeister
<phihag@phihag.de>
Mon, 20 Jun 2016 11:29:13 +0000
(13:29 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Mon, 20 Jun 2016 11:29:13 +0000
(13:29 +0200)
This reverts commit
7c05097633138459e9bdf7e10738e021b04689a7
.
youtube_dl/jsinterp.py
patch
|
blob
|
history
diff --git
a/youtube_dl/jsinterp.py
b/youtube_dl/jsinterp.py
index 4a5a0dbc3fca59e06a268e51c3a0161ede74db70..a7440c58242079ea1c6874e1bed0abe756fdc814 100644
(file)
--- a/
youtube_dl/jsinterp.py
+++ b/
youtube_dl/jsinterp.py
@@
-131,8
+131,9
@@
class JSInterpreter(object):
if variable in local_vars:
obj = local_vars[variable]
else:
if variable in local_vars:
obj = local_vars[variable]
else:
- obj = self._objects.setdefault(
- variable, self.extract_object(variable))
+ if variable not in self._objects:
+ self._objects[variable] = self.extract_object(variable)
+ obj = self._objects[variable]
if arg_str is None:
# Member access
if arg_str is None:
# Member access
@@
-203,7
+204,8
@@
class JSInterpreter(object):
argvals = tuple([
int(v) if v.isdigit() else local_vars[v]
for v in m.group('args').split(',')])
argvals = tuple([
int(v) if v.isdigit() else local_vars[v]
for v in m.group('args').split(',')])
- self._functions.setdefault(fname, self.extract_function(fname))
+ if fname not in self._functions:
+ self._functions[fname] = self.extract_function(fname)
return self._functions[fname](argvals)
raise ExtractorError('Unsupported JS expression %r' % expr)
return self._functions[fname](argvals)
raise ExtractorError('Unsupported JS expression %r' % expr)