Fix splice to handle float

Needed for new youtube js player f1ca6900
Add 57dbe8077f (diff-729b57caa8d006426f6a8960c061f519a8b6658682284015e069745af52ffb07)
This commit is contained in:
dirkf 2021-11-27 02:06:13 +00:00
parent e1eae16b56
commit 1ca673bd98

View File

@ -416,7 +416,7 @@ class JSInterpreter(object):
elif member == 'splice': elif member == 'splice':
assertion(isinstance(obj, list), 'must be applied on a list') assertion(isinstance(obj, list), 'must be applied on a list')
assertion(argvals, 'takes one or more arguments') assertion(argvals, 'takes one or more arguments')
index, howMany = (argvals + [len(obj)])[:2] index, howMany = map(int, (argvals + [len(obj)])[:2])
if index < 0: if index < 0:
index += len(obj) index += len(obj)
add_items = argvals[2:] add_items = argvals[2:]