Skip to content

Commit

Permalink
Merge pull request #159 from felipeucelli/jsinterp-update
Browse files Browse the repository at this point in the history
Fixed "slice must be applied on a list in: a.slice(0,0)"
  • Loading branch information
JuanBindez authored Aug 7, 2024
2 parents 2097bde + d8885f7 commit 1c248fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pytubefix/jsinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,9 @@ def eval_method():
obj.reverse()
return obj
elif member == 'slice':
assertion(isinstance(obj, list), 'must be applied on a list')
assertion(len(argvals) == 1, 'takes exactly one argument')
return obj[argvals[0]:]
assertion(isinstance(obj, (list, str)), 'must be applied on a list or string')
assertion(len(argvals) <= 2, 'takes between 0 and 2 arguments')
return obj[slice(*argvals, None)]
elif member == 'splice':
assertion(isinstance(obj, list), 'must be applied on a list')
assertion(argvals, 'takes one or more arguments')
Expand Down

0 comments on commit 1c248fc

Please sign in to comment.