Skip to content

Commit

Permalink
[jsinterp] 'reverse' modifies the array in place (fixes #3334)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimeMF committed Jul 24, 2014
1 parent 825abb8 commit ebe832d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion test/test_youtube_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@
u'js',
84,
u'123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ0STUVWXYZ!"#$%&\'()*+,@./:;<=>'
)
),
(
u'https://s.ytimg.com/yts/jsbin/html5player-en_US-vfl9FYC6l.js',
u'js',
83,
u'123456789abcdefghijklmnopqr0tuvwxyzABCDETGHIJKLMNOPQRS>UVWXYZ!"#$%&\'()*+,-./:;<=F'
),
]


Expand Down
3 changes: 2 additions & 1 deletion youtube_dl/jsinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def interpret_expression(self, expr, local_vars, allow_recursion):
return argvals[0].join(obj)
if member == 'reverse':
assert len(argvals) == 0
return obj[::-1]
obj.reverse()
return obj
if member == 'slice':
assert len(argvals) == 1
return obj[argvals[0]:]
Expand Down

0 comments on commit ebe832d

Please sign in to comment.