wmingjian / pyv8 Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/pyv8
Automatically exported from code.google.com/p/pyv8
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
Malic:pyv8-read-only Malic$ python setup.py install
running install
running build
running build_py
running build_ext
building '_PyV8' extension
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-fno-strict-aliasing -
fno-common -dynamic -DNDEBUG -g -O3 -DBOOST_PYTHON_STATIC_LIB -
DV8_NATIVE_REGEXP -DENABLE_DISASSEMBLER -DENABLE_LOGGING_AND_PROFILING -
DENABLE_DEBUGGER_SUPPORT -DV8_TARGET_ARCH_IA32 -
I/users/malic/code/python/v8/include -I/users/malic/code/python/v8 -
I/users/malic/code/python/v8/src -I/opt/local/include -
I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c
src/Exception.cpp
-o build/temp.macosx-10.3-fat-2.6/src/Exception.o
In file included from src/Exception.cpp:1:
src/Exception.h:3:19: error: cassert: No such file or directory
src/Exception.h:4:21: error: stdexcept: No such file or directory
src/Exception.h:18:17: error: cmath: No such file or directory
src/Exception.h:23:28: error: boost/python.hpp: No such file or directory
src/Exception.cpp:3:19: error: sstream: No such file or directory
In file included from /users/malic/code/python/v8/src/v8.h:56,
from src/Exception.cpp:15:
/users/malic/code/python/v8/src/globals.h:53:2: error: #error Host architecture
was not
detected as supported by v8
/users/malic/code/python/v8/src/globals.h:58:2: error: #error Target
architecture ia32 is only
supported on ia32 host
In file included from /users/malic/code/python/v8/src/platform.h:96,
from /users/malic/code/python/v8/src/log.h:31,
from /users/malic/code/python/v8/src/spaces.h:32,
from /users/malic/code/python/v8/src/v8.h:64,
from src/Exception.cpp:15:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No
such file or
directory
In file included from /users/malic/code/python/v8/src/conversions-inl.h:32,
from /users/malic/code/python/v8/src/objects-inl.h:40,
from /users/malic/code/python/v8/src/v8.h:66,
from src/Exception.cpp:15:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/float.h:8:24: error: float.h: No
such file or
directory
In file included from src/Exception.cpp:1:
src/Exception.h:19: error: ‘std::isnan’ has not been declared
src/Exception.h:24: error: ‘boost’ has not been declared
src/Exception.h:24: error: ‘python’ is not a namespace-name
src/Exception.h:24: error: expected namespace-name before ‘;’ token
In file included from src/Exception.cpp:1:
src/Exception.h:38: error: ‘PyGILState_STATE’ does not name a type
src/Exception.h:50: error: expected ‘;’ before ‘(’ token
src/Exception.h:51: error: ‘PyObject’ has not been declared
src/Exception.h:51: error: ‘py’ has not been declared
src/Exception.h:51: error: expected ‘,’ or ‘...’ before ‘*’ token
src/Exception.h:55: error: expected class-name before ‘{’ token
and bunch of other errors
gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5657)
Original issue reported on code.google.com by [email protected]
on 2 May 2010 at 4:01
This patch adds new parameter BOOST_PYTHON_MT to build system. If it
evaluates to True, pyv8 links to libboost_python-mt else libbboost_python.
It's needed for current Ubuntu Karmic. Need to verify on other platforms.
Original issue reported on code.google.com by [email protected]
on 25 Jan 2010 at 7:31
Attachments:
Attached is a patch with a test case showing the problem, array3[9] ===
undefined fails and instead raises a RangeError
Original issue reported on code.google.com by sciyoshi
on 3 Jan 2010 at 9:18
Attachments:
(http://groups.google.com/group/pyv8/browse_thread/thread/78df210cac5cfbc3)
I'm having some problems running different JSContext instances in
different threads. This is a simplified example:
--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--
from __future__ import with_statement
from pyv8 import PyV8
from threading import Thread
class PyV8Tread(Thread):
def run(self):
with PyV8.JSContext() as context:
context.eval("1+1")
t1 = PyV8Tread()
t2 = PyV8Tread()
t3 = PyV8Tread()
t1.start()
t2.start()
t3.start()
--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--
When I run those lines, I randomly get:
a) "#
# Fatal error in ..\..\src\top.cc, line 283
# CHECK(thread_local_.TryCatchHandler() == that) failed
#"
b) Python crashes
With this modification:
--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--
class PyV8Tread(Thread):
def run(self):
class Global(PyV8.JSClass):
def hello(self):
print "Hello World"
with PyV8.JSContext(Global()) as context:
context.eval("hello()")
--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--o--
I get:
"#
# Fatal error in ..\..\src\frames.cc, line 46
# CHECK(frame->sp() <= handler->address()) failed
#
Attempt to print stack while printing stack (double fault)
If you are lucky you may find a partial stack dump on stdout.
==== Stack trace ============================================"
Python 2.5
Boost 1.42
V8 trunk, revision 4135
Original issue reported on code.google.com by [email protected]
on 18 Mar 2010 at 7:23
What steps will reproduce the problem?
import PyV8
import eventlet
class Global(PyV8.JSClass):
def sleep(self, seconds):
eventlet.sleep(seconds)
def run(n):
with PyV8.JSContext(Global()) as ctx:
return ctx.eval("sleep(2);")
pool = eventlet.GreenPool()
for result in pool.imap(run, xrange(5)):
print result
What is the expected output? What do you see instead?
Expected:
None
None
None
None
None
Instead:
Segmentation Fault
What version of the product are you using? On what operating system?
Eventlet 0.9.7, PyV8 0.9, V8 2.2.9, Python 2.6.2, Ubuntu 9.04
Please provide any additional information below.
Strangely enough, if I compile the "sleep(2)", then run it, it works. Only
when I eval() something that would cause Eventlet to cooperatively yield
does it segfault.
Original issue reported on code.google.com by [email protected]
on 14 May 2010 at 9:52
Attachments:
Python is crashing evaluating 'prototype.js' (with my 'GlobalObject'). I've
attached a script to reproduce the crash.
What version of the product are you using? On what operating system?
- PyV8-0.9.win32-py2.6.exe on Windows Vista
- PyV8 rev. 246 compiled for Python 2.5 on Windows Vista
Original issue reported on code.google.com by [email protected]
on 7 Apr 2010 at 5:23
Attachments:
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
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:
On platforms where it's common to build/install with sudo, it's not obvious
V8_HOME needs to be set for the root user. If you don't know this, you run
setup.py and it dies with:
Traceback (most recent call last):
File "setup.py", line 17, in <module>
os.path.join(os.environ.get('V8_HOME'), 'include'),
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/pytho
n2.6/posixpath.py", line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
This is not terribly obvious that the problem is that V8_HOME is not being
set because you're running as root. I propose that you do an explicit check
for V8_HOME at the beginning of setup.py and make sure it's there. If not,
tell the user it's not set in the environment setup.py is being run in
(perhaps even mention it must be set for root if using sudo).
Original issue reported on code.google.com by [email protected]
on 10 Jan 2010 at 7:06
Memory usage constantly increases while calling same function again and
again by the size of passed arguments (i am passing an array of 1000
elements for example). Without any arguments there are small leak (about 500
bytes) too.
Original issue reported on code.google.com by [email protected]
on 7 Apr 2010 at 5:53
Attachments:
First off all, thanks for all the help lately!
I'm having a sporadic crash. It happens after calling this module a couple
of times (from the same process):
--++--++--++--++--++--++--++--++--++--++--++--++--++--
from pyv8 import PyV8
def extractor(scripts):
global_object = GlobalObject()
with PyV8.JSContext(global_object) as js_context:
for script in scripts:
js_context.eval(str(script))
return global_object.interesting_lines
--++--++--++--++--++--++--++--++--++--++--++--++--++--
("GlobalObject" just checks against some regexps if the line of code
executed/value returned is interesting)
I can't easily reproduce it, but I always get the following stack trace:
-[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--
#
# Fatal error in w:\external\lib\v8\src\objects-inl.h, line 1586
# CHECK(object->IsJSObject()) failed
#
==== Stack trace ============================================
Security context: 05D754FD <JS Object>#0#
1: /* anonymous */(this=05D75AA9 <JS Object>#1#)
==== Details ================================================
[1]: /* anonymous */(this=05D75AA9 <JS Object>#1#) {
// stack-allocated locals
var .result = 03290135 <undefined>
// expression stack (top to bottom)
[01] : 0
--------- s o u r c e c o d e ---------
???????????????????????????????????????????const
$Object=global.Object;?const $Array=global.Array;?const
$String=global.String;?const $Number=global.Number;?const
$Function=global.Function;?const $Boolean=global.Boolean;?const
$NaN=0/0;????function EQUALS(a){?if((typeof(this)==='string')&&(typeof(a)...
-----------------------------------------
}
==== Key ============================================
#0# 05D754FD: 05D754FD <JS Object>
#1# 05D75AA9: 05D75AA9 <JS Object>
=====================
-[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--[]--
My application has an embedded Python (2.5) with some custom modifications.
Also, Boost version is 1.41.0. V8 trunk, rev 4135. PyV8 trunk, rev 241.
It may have something to do with my custom scenario. Any help would be
appreciated. Thanks!
Original issue reported on code.google.com by [email protected]
on 19 Mar 2010 at 8:41
gauss@pmain:~/Projects/pyv8$ python setup.py bdist
running bdist
running bdist_dumb
running build
running build_py
running build_ext
building '_PyV8' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -fPIC -DBOOST_PYTHON_STATIC_LIB -DV8_NATIVE_REGEXP -
DENABLE_DISASSEMBLER -DENABLE_LOGGING_AND_PROFILING -
DENABLE_DEBUGGER_SUPPORT -DV8_TARGET_ARCH_IA32 -
I/home/gauss/Projects/v8/include -I/home/gauss/Projects/v8 -
I/home/gauss/Projects/v8/src -I/usr/include/python2.6 -c src/PyV8.cpp -o
build/temp.linux-i686-2.6/src/PyV8.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
In file included from /home/gauss/Projects/v8/src/objects-inl.h:40,
from /home/gauss/Projects/v8/src/v8.h:66,
from src/AST.h:4,
from src/PyV8.cpp:8:
/home/gauss/Projects/v8/src/conversions-inl.h: In function 'double
v8::internal::DoubleToInteger(double)':
/home/gauss/Projects/v8/src/conversions-inl.h:64: error: 'isfinite' was not
declared in this scope
/home/gauss/Projects/v8/src/conversions-inl.h: In function 'int32_t
v8::internal::DoubleToInt32(double)':
/home/gauss/Projects/v8/src/conversions-inl.h:86: error: 'isfinite' was not
declared in this scope
error: command 'gcc' failed with exit status 1
Original issue reported on code.google.com by [email protected]
on 25 Jan 2010 at 7:40
I should have noticed this when you asked me to verify #35 - sorry.
pyv8 builds fine, but does not import. This happens with pyv8 r233, and V8
trunk@3836 or bleeding_edge@3850:
Traceback (most recent call last):
File "PyV8.py", line 8, in <module>
import _PyV8
ImportError: /opt/Python-x86/lib/python2.7/site-packages/_PyV8.so:
undefined symbol: _ZTIN2v88internal10AstVisitorE
I wish I knew C++ so that I could just send a patch :)
Original issue reported on code.google.com by [email protected]
on 12 Feb 2010 at 8:46
While trying to port env.js to v8, ran into this issue. Here t1 is defined
in JS, t2 in Python with JSClass(), but __defineGetter__ for t2 returns the
unbound property object:
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyV8
>>> js = """
...
... var t1 = {};
...
... t1.__defineGetter__('attr', function() {
... debug('t1.attr');
... return 't1.attr';
... });
...
... t2.__defineGetter__('attr', function() {
... debug('t2.attr');
... return 't2.attr';
... });
...
... debug(t1.attr);
... debug(t2.attr);
...
... """
>>>
>>> class Globals(PyV8.JSClass):
... t2 = PyV8.JSClass()
... def debug(self, str):
... print str
...
>>> with PyV8.JSContext(Globals()) as ctx:
... ctx.eval(js)
...
t1.attr
t1.attr
<property object at 0xb7655a54>
Original issue reported on code.google.com by sciyoshi
on 30 Dec 2009 at 9:55
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
build/temp.linux-x86_64-2.6/src/Exception.o
build/temp.linux-x86_64-2.6/src/Context.o
build/temp.linux-x86_64-2.6/src/Engine.o
build/temp.linux-x86_64-2.6/src/Wrapper.o
build/temp.linux-x86_64-2.6/src/Debug.o
build/temp.linux-x86_64-2.6/src/Locker.o
build/temp.linux-x86_64-2.6/src/PyV8.o -L/devel/00-cvs/js/v8 -L/devel/lib
-lboost_python -lv8static -lrt -o build/lib.linux-x86_64-2.6/_PyV8.so -fPIC
./helloworld.py
Traceback (most recent call last):
File "./helloworld.py", line 4, in <module>
import PyV8
File "./PyV8.py", line 8, in <module>
import _PyV8
AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is
read-only
Original issue reported on code.google.com by [email protected]
on 27 Apr 2010 at 4:22
What steps will reproduce the problem?
import PyV8 will exception
What version of the product are you using? On what operating system?
ubuntu 9.10 x86, python 2.6
V8 and PyV8 from current svn
Original issue reported on code.google.com by [email protected]
on 9 Mar 2010 at 9:11
This patch enables to link with library v8_g if environment variable DEBUG
is set. Please check it on another platforms (i have checked it only on
linux).
Sample usage:
build v8 with:
$ scons mode=debug
now build pyv8 with:
$ export DEBUG=1
$ export V8_HOME=/path/to/v8
$ python setup.py bdist
...
...
profit!
Original issue reported on code.google.com by [email protected]
on 19 Jan 2010 at 11:27
Attachments:
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:
What steps will reproduce the problem?
1. register two different native JSExtension
---
firstSrc = "native function hello();"
firstPy = JSExtension("hello/python", firstSrc, lambda firstfunc: lambda
name: "[HELLO] [" + name + "]", register=False)
firstPy.register()
secondSrc = "native function test();"
secondPy = JSExtension("test/python", secondSrc, lambda secondfunc: lambda
name: "[TEST] [" + name + "]", register=False)
secondPy.register()
with JSContext(extensions=['test/python', 'hello/python']) as ctx:
res = ctx.eval("hello('flier')")
print 'RES: '+ res
---
What is the expected output? What do you see instead?
RES: [HELLO] [flier]
instead i get
---
Traceback (most recent call last):
File "testjs.py", line 20, in <module>
with JSContext(extensions=['test/python', 'hello/python']) as ctx:
File "C:\Python26\lib\site-packages\PyV8.py", line 411, in __init__
_PyV8.JSContext.__init__(self, obj, extensions)
PyV8.JSError: JSError: <v8::Context::New()> Cannot find required extension
---
What version of the product are you using? On what operating system?
the build attached here: http://code.google.com/p/pyv8/issues/detail?
id=12&can=1&q=__doc__#c2
OS: win 7 x86 32 bit
Please provide any additional information below.
registering two _javascript_ extensions works
Original issue reported on code.google.com by [email protected]
on 25 Dec 2009 at 10:23
Ubuntu 10.04 updated, PyV8 r253, V8 r4380
gauss@pmain:~/Projects/pyv8$ python PyV8.py
.....................Fhello world
..............
======================================================================
FAIL: testDate (__main__.TestWrapper)
----------------------------------------------------------------------
Traceback (most recent call last):
File "PyV8.py", line 1004, in testDate
self.assert_(str(func(now)).startswith(now.strftime("%a %b %d %Y
%H:%M:%S")))
AssertionError
----------------------------------------------------------------------
Ran 36 tests in 3.267s
FAILED (failures=1)
Original issue reported on code.google.com by [email protected]
on 10 Apr 2010 at 7:18
pyv8 doesn't seem to build with V8 "stable edge" r3836, or bleeding edge
(same error):
running build_ext
building '_PyV8' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -DNDEBUG -O2 -march=core2 -m32 -m32 -fPIC
-DBOOST_PYTHON_STATIC_LIB -DV8_NATIVE_REGEXP -DENABLE_DISASSEMBLER
-DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT
-DV8_TARGET_ARCH_IA32 -I/med/builds/v8/include -I/med/builds/v8
-I/med/builds/v8/src
-I/home/sys/deploy/installed/Python-x86/include/python2.7 -c src/AST.cpp -o
build/temp.linux-x86_64-2.7/src/AST.o
In file included from src/AST.cpp:1:
src/AST.h: In member function ‘v8::internal::Expression::Context
CAstExpression::context() const’:
src/AST.h:103: error: ‘class v8::internal::Expression’ has no member named
‘context’
error: command 'gcc' failed with exit status 1
I'm on 64-bit Ubuntu karmic with gcc 4.4.1, and compiling v8, boost-python,
and pyv8 as 32-bit.
Original issue reported on code.google.com by [email protected]
on 12 Feb 2010 at 2:13
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
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
While running unittest of pyv8 svn changeset 187 on Ubuntu Karmic:
gauss@pmain:~/Projects/pyv8$ python PyV8.py
........................PyV8.py:772: DeprecationWarning:
BaseException.message has been deprecated as of Python 2.6
ctxt.eval("try { this.raiseNotImplementedError(); } catch (e) { msg = e;
}")
......PyV8.py:735: DeprecationWarning: BaseException.message has been
deprecated as of Python 2.6
}""")
...
----------------------------------------------------------------------
Ran 33 tests in 4.218s
OK
Original issue reported on code.google.com by [email protected]
on 1 Jan 2010 at 5:56
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
What I'm trying achieve is to provide a mock jQuery object to V8, which is
both a function and has methods/properties. I may be doing something wrong,
since I've just started learning about V8 and PyV8. Anyways, I've gotten
the issue down to the following test case, which segfaults on Ubuntu Karmic
with the latest PyV8 from SVN (boost is 1.40).
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyV8
>>> class JQuery(object):
... def __call__(self, *args, **kwargs):
... print '__call__():', args, kwargs
... def test(self, *args, **kwargs):
... print 'test():', args, kwargs
...
>>> globals = PyV8.JSClass()
>>> setattr(globals, '$', JQuery())
>>>
>>> with PyV8.JSContext(globals) as ctx:
... ctx.eval('$.test("calling", "test")');
... ctx.eval('$("calling", "__call__")');
...
test(): ('calling', 'test') {}
Segmentation fault
So $.test() works fine, but $() doesn't; is there a better way to be doing
this?
Original issue reported on code.google.com by sciyoshi
on 30 Dec 2009 at 12:49
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
Compiling PyV8 0.8 on OS X (10.6) will die with:
/tmp/v8/src/conversions-inl.h: In function ‘double
v8::internal::DoubleToInteger(double)’:
/tmp/v8/src/conversions-inl.h:63: error: ‘isnan’ was not declared in this
scope
Googling found this:
http://old.nabble.com/Re:-(Update)-Difficulty-building-Gazebo-on-
OSX-10.4-(ltdl-and-ODE-trimesh)-td19023897.html
"It seems the issue with isnan is that the isnan macro is carefully removed
from math.h on OSX in favor of using std::isnan."
It suggested adding:
#include <cmath>
extern "C" int isnan(double);
When I did this, PyV8 compiled just fine. It may need a macro to protect it
on other platforms.
Original issue reported on code.google.com by [email protected]
on 5 Jan 2010 at 4:55
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
If this is the following scope for the Javascript:
class Globals(PyV8.JSClass)
d = {'a': {'b': 'c'}, 'd': ['e', 'f']}
then any attempt to access d.a or d.d will return undefined, which is
slightly unexpected (since JS treats d['a'] and d.a the same), and makes it
awkward to pass JSON data between Python and JS. Attaching a patch which
makes Named[GS]etter check if the object supports the mapping protocol, and
if so uses that instead.
Original issue reported on code.google.com by sciyoshi
on 1 Jan 2010 at 8:44
Attachments:
Can't determine what's happens, but it happens on PyV8.JSContext(None)!...
Original issue reported on code.google.com by [email protected]
on 20 Jan 2010 at 12:36
Attachments:
This patch simplifies multiple rebuilds by allowing to set any configuration
variable (like V8_HOME, DEBUG, etc..) to be set in file buildconf.py
Original issue reported on code.google.com by [email protected]
on 20 Jan 2010 at 12:22
Attachments:
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
-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 [email protected]
on 10 Jan 2010 at 12:10
http://groups.google.com/group/pyv8/browse_thread/thread/508a525518ba
3747?hl=en
dieresys
View profile
More options Mar 2, 6:13 am
I'm trying to analyze chunks of javascript without providing the
object model. I've found that if the global object defines a
"__getattr__" method, it's called twice for each undefined attributes
found in the script.
For example:
------------------------------------------------------------------------
import PyV8
class Global(PyV8.JSClass):
def __getattr__(self, name):
print name
return self
def alert(self, value):
print value
js_context = PyV8.JSContext(Global())
with js_context:
js_context.eval("alert(window.location.href);")
------------------------------------------------------------------------
should print this:
------------------------------------------------------------------------
window
location
href
<__main__.Global object at 0x01C7C610>
------------------------------------------------------------------------
but it's printing:
------------------------------------------------------------------------
window
window
location
location
href
href
<__main__.Global object at 0x01C7C610>
------------------------------------------------------------------------
Original issue reported on code.google.com by [email protected]
on 1 Mar 2010 at 11:05
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
With PyV8 0.8 setup.py, on OS X 10.6 Python's os.name == 'posix' so the
"mac" branch never runs for me. What's more, a few changes need to be made
for it to work:
1) boost_python library be changed to boost_python-mt
2) rt library needs to be removed
3) "/opt/local/include" needs to be added to include_dirs for boost to be
found.
This is all assuming you used MacPorts to install Boost.
Original issue reported on code.google.com by [email protected]
on 10 Jan 2010 at 7:01
Builds successfully if V8 is built with
GCC_VERSION=44 scons arch=x64
and PyV8 is built with
CFLAGS="-O0" V8_HOME=~/v8 python setup.py build --debug
but running the test suite in PyV8 segfaults with the following backtrace:
#0 0x000000000045417a in PyObject_Malloc ()
#1 0x000000000045bd12 in PyString_FromStringAndSize ()
#2 0x00007ffff66be977 in boost::python::detail::str_base::str_base(char
const*, unsigned long) () from /usr/lib/libboost_python-py26.so.1.40.0
#3 0x00007ffff69e4b63 in str (this=0x7fffffffb950, start=0x93f750 "人",
length=3) at /usr/include/boost/python/str.hpp:155
#4 0x00007ffff6a0c583 in CJavascriptObject::Wrap (value=..., self=...) at
src/Wrapper.cpp:847
#5 0x00007ffff69f0e95 in CEngine::ExecuteScript (this=0x7fffffffbb3f,
script=...) at src/Engine.cpp:367
#6 0x00007ffff69f0f43 in CScript::Run (this=0xa6cb50) at src/Engine.cpp:374
#7 0x00007ffff69e4455 in CContext::Evaluate (this=0xaad270, src=...) at
src/Context.cpp:157
#8 0x00007ffff69eea20 in
boost::python::detail::invoke<boost::python::to_python_value<boost::python::api:
:object
const&>, boost::python::api::object (CContext::*)(std::string const&),
boost::python::arg_from_python<CContext&>,
boost::python::arg_from_python<std::string const&> > (rc=..., f=@0x96f698,
tc=..., ac0=...) at /usr/include/boost/python/detail/invoke.hpp:88
#9 0x00007ffff69ed74f in
boost::python::detail::caller_arity<2u>::impl<boost::python::api::object
(CContext::*)(std::string const&), boost::python::default_call_policies,
boost::mpl::vector3<boost::python::api::object, CContext&, std::string
const&> >::operator() (this=0x96f698, args_=0xa3b998) at
/usr/include/boost/python/detail/caller.hpp:223
#10 0x00007ffff69ec675 in
boost::python::objects::caller_py_function_impl<boost::python::detail::caller<bo
ost::python::api::object
(CContext::*)(std::string const&), boost::python::default_call_policies,
boost::mpl::vector3<boost::python::api::object, CContext&, std::string
const&> > >::operator() (this=0x96f690, args=0xa3b998, kw=0x0) at
/usr/include/boost/python/object/py_function.hpp:38
#11 0x00007ffff66cbd4e in boost::python::objects::function::call(_object*,
_object*) const () from /usr/lib/libboost_python-py26.so.1.40.0
#12 0x00007ffff66cbf38 in ?? () from /usr/lib/libboost_python-py26.so.1.40.0
#13 0x00007ffff66d4213 in
boost::python::detail::exception_handler::operator()(boost::function0<void>
const&) const () from /usr/lib/libboost_python-py26.so.1.40.0
#14 0x00007ffff69df082 in
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>::operator() (this=0x88bb38, handler=...,
f=...,
translate=0x7ffff69da3ee
<ExceptionTranslator::Translate(CJavascriptException const&)>) at
/usr/include/boost/python/detail/translate_exception.hpp:46
#15 0x00007ffff69de87f in boost::_bi::list3<boost::arg<1>, boost::arg<2>,
boost::_bi::value<void (*)(CJavascriptException const&)>
>::operator()<bool,
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>,
boost::_bi::list2<boost::python::detail::exception_handler const&,
boost::function0<void> const&> > (this=0x88bb40, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:375
#16 0x00007ffff69de0d8 in boost::_bi::bind_t<bool,
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>, boost::_bi::list3<boost::arg<1>,
boost::arg<2>, boost::_bi::value<void (*)(CJavascriptException const&)> >
>::operator()<boost::python::detail::exception_handler,
boost::function0<void> > (this=0x88bb38, a1=..., a2=...)
at /usr/include/boost/bind/bind_template.hpp:102
#17 0x00007ffff69ddbae in
boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool,
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>, boost::_bi::list3<boost::arg<1>,
boost::arg<2>, boost::_bi::value<void (*)(CJavascriptException const&)> >
>, bool, boost::python::detail::exception_handler const&,
boost::function0<void> const&>::invoke (
function_obj_ptr=..., a0=..., a1=...) at
/usr/include/boost/function/function_template.hpp:132
#18 0x00007ffff66d3fe3 in
boost::python::handle_exception_impl(boost::function0<void>) () from
/usr/lib/libboost_python-py26.so.1.40.0
#19 0x00007ffff66c96b8 in ?? () from /usr/lib/libboost_python-py26.so.1.40.0
Original issue reported on code.google.com by sciyoshi
on 8 Jan 2010 at 9:30
What steps will reproduce the problem?
1. Tried to implement a simple generator, but i cant loop with either
for(var k in arr) / for(var i=0;i<arr.length...)
Seems that __len__/__getitem__ are not called.
Is it something i'm doing wrong or its not supported?
What version of the product are you using? On what operating system?
PyV8 0.9/winxp (with py2.6 x86)
Original issue reported on code.google.com by [email protected]
on 10 Mar 2010 at 3:11
Seems like the fix that was committed for issue #18 broke some other
things. I'm not able to come up with a test case for it, but seems the
problem is that __[gs]et__ is only called on the attributes of the object's
type, so that [gs]etattr(obj, name, property) won't do the right thing.
I've added to the testcase to show the problem, along with a fix (which
reverts #185 and instead fixes it from the Python side).
Original issue reported on code.google.com by sciyoshi
on 31 Dec 2009 at 7:29
Attachments:
SVN r201, V8 2.0.5.4 static, python 2.6.2 on ubuntu jaunty
-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-
gauss@pmain:~/Projects/pyv8test$ ./helloworld.py
Traceback (most recent call last):
File "./helloworld.py", line 20, in <module>
print PyV8.convert(obj.abla())
File "/usr/local/lib/python2.6/dist-packages/PyV8.py", line 433, in
convert
return dict([[k, convert(obj.__getattr__(k))] for k in
obj.__members__])
Boost.Python.ArgumentError: Python argument types in
JSObject.__getattr__(JSObject, int)
did not match C++ signature:
__getattr__(CJavascriptObject {lvalue}, std::string)
Original issue reported on code.google.com by [email protected]
on 12 Jan 2010 at 6:07
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:
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
[b]What steps will reproduce the problem?[/b]
1. import PyV8
2. PyV8.JSArray([1,2,3])
This error does not occour when we first enter to a context;
1. import PyV8
2. context=PyV8.JSContext()
3. context.enter()
4. PyV8.JSArray([1,2,3])
<_PyV8.JSArray object at 0x0120A8A0>
The reason we might have to use JSArray before entering to a context would
be using a globals class;
import PyV8
class Globals(PyV8.JSClass):
def __init__(self):
self.test=PyV8.JSArray([1,2,3])
context=PyV8.JSContext(Globals())
//segfault
[b]What is the expected output? What do you see instead?[/b]
A JSArray object but I get a segfault.
[b]What version of the product are you using? On what operating system?[/b]
PyV8-0.7.1.win32-py2.6.exe
Python2.6.2,
PyV8-0.7.1,
Windows XP Professional
Thank you.
Original issue reported on code.google.com by [email protected]
on 24 Dec 2009 at 8:37
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
This patch allows django to show javascript errors in html tracebacks.
Without __unicode__ method, no exc_value strings shown.
-begin patch-
Index: PyV8.py
===================================================================
--- PyV8.py (revision 201)
+++ PyV8.py (working copy)
@@ -18,6 +18,9 @@
def __str__(self):
return str(self._impl)
+
+ def __unicode__(self):
+ return unicode(self._impl)
def __getattribute__(self, attr):
impl = super(JSError, self).__getattribute__("_impl")
-end patch-
Original issue reported on code.google.com by [email protected]
on 12 Jan 2010 at 11:07
What steps will reproduce the problem?
1. Run this script:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
import PyV8
ext1 = PyV8.JSExtension("ext1/javascript", str("function hello1(){1+1}"))
# XXX: now we remove the reference to the first JSExtension
ext1 = 123
js_context = PyV8.JSContext()
print ext1
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
What is the expected output? What do you see instead?
Expected: "123" is printed
Instead: Python.exe crashes. The call stack is something like:
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
msvcr80d.dll!strlen(unsigned char * buf=0x08466358) Line 69Asm
_PyV8_d.pyd!v8::internal::StrLength() + 0xd bytes
_PyV8_d.pyd!v8::internal::CStrVector() + 0xc bytes
_PyV8_d.pyd!v8::internal::Genesis::InstallExtension() + 0x104 bytes
_PyV8_d.pyd!v8::internal::Genesis::InstallExtensions() + 0x5e bytes
_PyV8_d.pyd!v8::internal::Genesis::Genesis() + 0xec bytes
_PyV8_d.pyd!v8::internal::Bootstrapper::CreateEnvironment() + 0x1a bytes
_PyV8_d.pyd!v8::Context::New() + 0x1db bytes
_PyV8_d.pyd!CContext::CContext(boost::python::api::object global={...},
boost::python::list extensions={...}) Line 75 + 0x31 bytes
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
What version of the product are you using? On what operating system?
PyV8 v09 for Python 2.6
Vista 32bits
Original issue reported on code.google.com by [email protected]
on 18 Mar 2010 at 9:38
I am trying to use PyV8 on Linux and Mac OS X. The build is ok but the
following error occurs (on both platforms) while importing PyV8 in python.
$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyV8
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "PyV8.py", line 8, in <module>
import _PyV8
ImportError: dlopen(./_PyV8.so, 2): Symbol not found:
__ZN2v819RegisteredExtension16first_extension_E
Referenced from: ...pyv8-read-only/build/lib.macosx-10.6-universal-2.6/_PyV8.so
Expected in: flat namespace
in ...pyv8-read-only/build/lib.macosx-10.6-universal-2.6/_PyV8.so
Both platforms show similar error messages:
Ubuntu 9.10 32 bits
Mac OS X 10.6.2 (with 64 bits Python)
Original issue reported on code.google.com by edwincheese
on 12 Feb 2010 at 9:51
What steps will reproduce the problem?
1. i'd attached the example code
2.
3.
What is the expected output? What do you see instead?
Print from 0-999 and nothing. Instead i get a crash after 999.
What version of the product are you using? On what operating system?
PyV8 0.8 (win32-2.6 with python 2.6-win32 on x64 machine)
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 22 Feb 2010 at 2:59
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.