RoamUniverse / pyv8

Automatically exported from code.google.com/p/pyv8
0 stars 0 forks source link

'pure virtual method called' while trying to convert list of lists #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
-begin script-
import PyV8

class Global(PyV8.JSClass):
    pass

script = """ 
({ 
    'abla': function(){ 
        return  [ 
            [ 1, 'abla' ], 
            [ 2, 'ajkss' ], 
        ] 
    } 
}) 
"""

with PyV8.JSContext(Global()) as ctxt:
    obj = ctxt.eval(script)
    print PyV8.convert(obj.abla())
-end script-

Original issue reported on code.google.com by gauss...@gmail.com on 10 Jan 2010 at 12:10

GoogleCodeExporter commented 9 years ago
Sorry, forgot:

gauss@pmain:~/Projects/pyv8test$ ./helloworld.py
pure virtual method called
terminate called without an active exception
Aborted

Original comment by gauss...@gmail.com on 10 Jan 2010 at 12:11

GoogleCodeExporter commented 9 years ago
latest svn, python 2.6 on ubuntu 9.04 with v8 2.0.5.4 static

Original comment by gauss...@gmail.com on 10 Jan 2010 at 12:13

GoogleCodeExporter commented 9 years ago
It is strange, the iterator will crash when we use nested array, you could use 
subscript as 
workaroud, like

for i in xrange(len(array))

Original comment by flier...@gmail.com on 10 Jan 2010 at 3:51

GoogleCodeExporter commented 9 years ago
The root cause is the iterator of JSArray return a temporary object. To fix it, 
I force the 
iterator::dereference method return value instead of reference to a temporary 
object. 

Please check out the source code from SVN after r201, and verify it, thanks

Original comment by flier...@gmail.com on 11 Jan 2010 at 4:24

GoogleCodeExporter commented 9 years ago
Thank you, it's ok now.

Original comment by gauss...@gmail.com on 12 Jan 2010 at 6:01

GoogleCodeExporter commented 9 years ago
Thanks :)

Original comment by flier...@gmail.com on 13 Jan 2010 at 2:22