Closed GoogleCodeExporter closed 8 years ago
Original comment by flier...@gmail.com
on 23 Jun 2011 at 1:31
I can't reproduce your issue, what's version of PyV8 that you are using? Could
you try the SVN trunk code? Thanks
from PyV8 import *
with JSContext() as ctxt:
a = ctxt.eval("a = Array(7); for(i=0; i<a.length; i++) a[i] = i; a[3] = undefined; a[a.length-1]; a")
print a # 0,1,2,,4,5,6
print [a[i] for i in range(len(a))] # [0, 1, 2, None, 4, 5, 6]
print list(a) # [0, 1, 2, None, 4, 5, 6]
Original comment by flier...@gmail.com
on 24 Jun 2011 at 4:20
Hi, sorry for the delay.
I have built PyV8 from the svn repository and got the same problem.
Using Python 2.6.5 on Ubuntu 10.04 64 bits:
I keep getting exceptions with code2 and code3. Of course, code1 works well and
don't raise any exception as it is supposed according to the title of the
issue. Only have problems when undefineds are at the leading or trailing
positions of the JSarray.
Thank you and regards!
Jose.
Here is the test I used:
>>> import PyV8
>>> ct = PyV8.JSContext()
>>> code1 = "a = Array(7); for(i=0; i<a.length; i++) a[i] = i; a[3] =
undefined; a[a.length-1]; a"
>>> code2 = "a = Array(7); for(i=0; i<a.length - 1; i++) a[i] = i;
a[a.length-1]; a"
>>> code3 = "a = Array(7); for(i=1; i<a.length; i++) a[i] = i; a[a.length-1]; a"
>>> ct.enter()
>>> a ct.eval(code1)
>>> for i in a:
... print str(i)
...
0
1
2
None
4
5
6
>>> a = ct.eval(code2)
>>> for i in a:
... print str(i)
...
0
1
2
3
4
5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: '[object Array]' index out of range
>>> a = ct.eval(code3)
>>> for i in a:
... print str(i)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: '[object Array]' index out of range
Original comment by jvil...@gmail.com
on 20 Jul 2011 at 8:44
Fixed, please verify it with SVN code after r391
Original comment by flier...@gmail.com
on 10 Aug 2011 at 5:24
Original issue reported on code.google.com by
jvil...@gmail.com
on 22 Jun 2011 at 7:59