Giter Site home page Giter Site logo

pyv8's People

Watchers

James Cloos avatar  avatar

pyv8's Issues

Segmentation fault

The broken code is:

    ops = ['==', '!=', '>', '<', '>=', '<=', '===', '!==']
    t = [ 0, 1, 2, 15, 123, -100, 
          "'0'", "'1'", "'2'", "'15'", "'123'", "'-100'",
          .0, .1, .2, .15, .123, -.100, 
          "'.0'", "'.1'", "'.2'", "'.15'", "'.123'", "'-.100'",
          '"abc"', "'abc'", "'абв'", "'测试'",
          "true", "false", "NaN", "Infinity", "null",
          "{}", "[]", "function(){}" ]

    for op in ops:
        for a in t:
            for b in t:
                t_ = "(%s %s %s)" % (a, op, b)
                print ">", t_
                ctx.eval(t_)

System: ubuntu hardy, python 2.5

Unfortunately i have no tested it in windows, as PyV8 raise exception on
import:

>>> import PyV8

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import PyV8
  File "C:\Python26\lib\site-packages\PyV8.py", line 8, in <module>
    import _PyV8
AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is
read-only

system: windows xp, python 2.6.4

Original issue reported on code.google.com by [email protected] on 18 Dec 2009 at 6:08

  • Merged into: #12

_PyV8.JSFunction != None results in segmentation fault.

    def testFunction(self):
        with JSContext() as ctxt:
            func = ctxt.eval("""
                function()
                {
                    function a()
                    {
                        return "abc";    
                    }

                    return a();    
                };
                """)
            if func is not None: # ok
                pass
            if func != None: # segmentation fault
                pass
            self.assertEquals("abc", str(func()))


Original issue reported on code.google.com by [email protected] on 31 Aug 2009 at 12:51

testUnicode fails on Debian Lenny

FAIL: testUnicode (__main__.TestWrapper)
Traceback (most recent call last):
  File "PyV8.py", line 839, in testUnicode
    self.assertEquals(2, func(u"测试"))
AssertionError: 2 != 1

Debian Lenny AMD64.
Python 2.5.2

Original issue reported on code.google.com by [email protected] on 9 Sep 2009 at 4:11

  • Merged into: #9

Python fatal error during RegExp match

What steps will reproduce the problem?
1. Install lastest pyv8
2. Run attached script "test.py"
3. See "Fatal Python error: deallocationg None

What is the expected output? 
Normal script execution or correct error message

What do you see instead?
Python fatal error 

What version of the product are you using? 
0.7.1

On what operating system?
Windows 7

Python shows fatal error if I run regexp matching cycling more than 1000 
times. On my computer it falls on 2000 matches.

Original issue reported on code.google.com by [email protected] on 14 Dec 2009 at 10:48

Attachments:

class instance not derived from object returned as Global causes segfault

class FileWrapper(object):
                 ^^^^^^^^ remove this to get a segfault
    def __init__(self, fname, mode):
        self.f = open(fname, mode)

    def seek(self, seekto=None):
        if seekto is None:
            return self.f.seek()
        return self.f.seek(seekto)

    def close(self):
        return self.f.close()

    def write(self, bytes):
        return self.f.write(bytes)

    def read(self, bytes=None):
        if bytes is None:
            return self.f.read()
        return self.f.read(bytes)

# Create a python class to be used in the context
class Global(PyV8.JSClass):
    def pyv8_open(self, fname, mode):
        return FileWrapper(fname, mode)



Original issue reported on code.google.com by [email protected] on 18 Sep 2009 at 5:00

Segfault on dir(jscontext.locals) before run jscontext

What steps will reproduce the problem?
1. import PyV8 in python
2. create context=PyV8.JSContext()
3. try run dir(context.locals) before context.enter()

What is the expected output? What do you see instead?

Exception in python, but i got segfault.

What version of the product are you using? On what operating system?

PyV8 0.7, Ubuntu 9.10 x64, static compiled version of V8, and own compiled 
libboost (bug in libboost-python1.38 Ubuntu 9.10). Python 2.6.4.

Original issue reported on code.google.com by [email protected] on 6 Nov 2009 at 9:25

Fatal: Refering to custom global object using 'this' keyword

This code fails on Linux:

class Global(object):pass
engine = PyV8.JSEngine(Global())
engine.eval("this")

Producing:
terminate called after throwing an instance of
'boost::python::error_already_set'
Aborted


If I don't use the custom global object, it succeeds.


Original issue reported on code.google.com by [email protected] on 17 Feb 2009 at 11:19

AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only

What steps will reproduce the problem?
1. Install PyV8-0.7.1.win32-py2.6 under Windows 7
2. Open the Python interpreter
3. import PyV8

What is the expected output? 
No error.

What do you see instead?
ActivePython 2.6.3.7 (ActiveState Software Inc.) based on
Python 2.6.3 (r263:75183, Oct  5 2009, 14:41:55) [MSC v.1500 32 bit 
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyV8
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Languages\Python26\lib\site-packages\PyV8.py", line 8, in 
<module>
    import _PyV8
AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is 
read-only

What version of the product are you using? On what operating system?
PyV8-0.7.1.win32-py2.6 under Win7 RC.

Please provide any additional information below.
The same version of PyV8 works fine under WinXP SP3.

Original issue reported on code.google.com by [email protected] on 10 Dec 2009 at 8:02

external python class can't be wrapped

got an obscure bug that could really use some outside help on, that used to
work (v8 from 4-6 months ago plus PyV8 0.4) and now doesn't (v8 from today
plus PyV8 0.5).
setup:
http://code.google.com/p/pyv8 you get from here
http://pyjs.org go to the sf.net svn get code from there.
do this:
cd pyjamas
python bootstrap.py
cd pyv8
./pyv8run.py test.py

if you get a segfault due to debugging, disable it:

@@ -119,7 +120,7 @@ $pyjs.trackstack.push($pyjs.track);
         fp.write(txt)
         fp.close()

-    PyV8.debugger.enabled = True
+    #PyV8.debugger.enabled = True

the error being shown is:

terminate called after throwing an instance of 'CJavascriptException'
  what():  <v8::External::Cast()> Could not convert to external
Aborted

the object involved is a python class.

Original issue reported on code.google.com by [email protected] on 24 Jun 2009 at 9:06

Incorrect unicode conversion between python object and javascript object on FreeBSD

I compiled PyV8 under freebsd, and got following error:

with JSContext() as c:
    c.locals.s = u"测试"
    print len(c.locals.s)    # this will print 1, instead of 2

    c.locals.s = u"1234"
    print len(c.locals.s)    # this will print 1, instead of 4

In fact assign an unicode to JSContext will always return its length as 1.

After dig into the code, I found this is caused because on my FreeBSD the
python unicode is defined as UCS4 - the wide unicode (on win32, it will be
UCS2) this caused a problem when converting python unicode to v8::String in
CPythonObject::Wrap() method.

I patched the method to check if python is using UCS4 or UCS2 to determine
how to convert python unicode to v8::String.

Attached is the patched Wrapper.cpp, line 458-470 is modified.

Original issue reported on code.google.com by [email protected] on 30 Sep 2009 at 5:18

Attachments:

Return context.eval() result as Python dict

First of all, pyv8 is awesome fast! Thank you for providing this wrapper.

I stumbled upon a problem with the result of the contect.eval() method. It 
returns a JSArray instead 
of a Python dict. Is there a way to convert this JSArray object into a dict? 
Wrapping the result with 
the dict() function ends in a segfault.

I even haven't found a way to list all keys of the JSArray to iterate over this 
object and create a dict 
by myself. I would like to convert the pyv8 result to a json. Maybe there is 
already an easy way to do 
this?

Thanks in advance and keep this great piece of code up.

Marc

Original issue reported on code.google.com by [email protected] on 5 May 2009 at 7:56

Segmentation fault

What steps will reproduce the problem?
On Ubuntu 8.04
1a. Use svn checkout http://v8.googlecode.com/svn/trunk/ v8
 or
1b. Use svn checkout http://v8.googlecode.com/svn/branches/bleeding_edge/ v8
2. Use svn checkout http://pyv8.googlecode.com/svn/trunk/ pyv8-read-only
3. apt-get install install libboost-python-dev
4. apt-get install scons
5. Compile v8 with 'scons' (no arguments)
6. Copy v8-debug.h, v8.h and libv8.a to the lib/v8/*/
7. python setup.py build
8. cd build/lib.linux-i686-2.5/
9. python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyV8
>>> e = PyV8.JSEngine(object())
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
Boost.Python.ArgumentError: Python argument types in
   JSEngine.__init__(JSEngine, object)
did not match C++ signature:
   __init__(_object*)
>>> e = PyV8.JSEngine()
>>> e.eval()
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: 'JSEngine' object has no attribute 'eval'
>>> e.compile()
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
Boost.Python.ArgumentError: Python argument types in
   JSEngine.compile(JSEngine)
did not match C++ signature:
   compile(CEngine {lvalue}, std::string source, std::string name='',
int line=-1, int col=-1)
>>> e.compile('a=1')
Segmentation fault


What is the expected output? What do you see instead?
Anything but 'Segmentation fault'

What version of the product are you using? On what operating system?
svn versions on Ubuntu 8.04

Please provide any additional information below.

The PyV8.JSEngine().eval() is not available which is used in the pyjamas
pyv8/pyv8run.py example.

Original issue reported on code.google.com by [email protected] on 20 Jun 2009 at 12:39

unicode?

hi~
the result of program:
None
None


False
True

the code in qval() is encoding with utf-8 or not?

Original issue reported on code.google.com by [email protected] on 21 Apr 2009 at 9:22

Attachments:

Port to linux =)

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 17 Oct 2009 at 1:56

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.