diff options
| author | Philipp Hagemeister <phihag@phihag.de> | 2016-06-20 13:29:13 +0200 | 
|---|---|---|
| committer | Philipp Hagemeister <phihag@phihag.de> | 2016-06-20 13:29:13 +0200 | 
| commit | 1f749b6658439049b952fdb979acb6c4422a358a (patch) | |
| tree | 683eea058732529937ea4044eeea9e07c657fb04 | |
| parent | 819707920a63946ea1e4f0ae2bf842425d22c2e9 (diff) | |
Revert "[jsinterp] Avoid double key lookup for setting new key"
This reverts commit 7c05097633138459e9bdf7e10738e021b04689a7.
| -rw-r--r-- | youtube_dl/jsinterp.py | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py index 4a5a0dbc3..a7440c582 100644 --- 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: -                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 @@ -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(',')]) -            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) | 
