Created by Friedrich Weber on 2010-06-12 and last modified on 2010-10-08
Get this branch:
bzr branch lp:~fredreichbier/+junk/pyjavascriptcore
Only Friedrich Weber can upload to this branch. If you are Friedrich Weber please log in for upload directions.

Related bugs

Related blueprints

Branch information

Friedrich Weber

Recent revisions

69. By Friedrich Weber <fred@klops> on 2010-10-08

Added some casts to make Cython 0.13 happy.

68. By Friedrich Weber <fred@klops> on 2010-06-11

Fixed segfault on 64bit systems caused by a missing check if a given JSValueRef is a JSObjectRef.

67. By Martín Soto <soto@masoft> on 2010-04-06

Additional fix to GIL handling in the JavaScript to Python wrappers

* javascriptcore.pyx (pyObjInitialize): Add a "with gil" clause.

66. By Martín Soto <soto@masoft> on 2010-04-06

Fix wrapper caching for 64-bit platforms

* javascriptcore.pyx (wrapJSObject): Cast pointers to long instead of int
  before using them as keys for the _pyWrappedJSObjs array. This is
  necessary in 64-bit platforms because the may have an int type that is
  actually smaller than the pointer type. This may fix Bug #504406.

65. By Martín Soto <soto@masoft> on 2010-04-05

Rename finalizeCb function for consistency

* javascriptcore.pyx (pyObjFinalize): Renamed from finalizeCb.

64. By Martín Soto <soto@masoft> on 2010-04-05

Fix GIL handling in the JavaScript to Python wrappers

All functions registered as callbacks with JavaScriptCore and using
functions in the Python interpreter should acquire the GIL. Several
weren't in practice. Thanks to <email address hidden> (Bug
) for pointing this out.

* javascriptcore.pyx (pyObjDeleteProperty, finalizeCb, pySeqHasProperty)
  (pySeqDeleteProperty, pyMapGetPropertyNames, pyMapDeleteProperty): Add
  a "with gil" clause.

63. By Martín Soto <soto@masoft> on 2009-12-02

 Return JavaScript numbers that are integers as instances of int

* javascriptcore.pyx (jsToPython): Return JavaScript numbers that are
  integers as instances of Python's int type.

* test/jsfrompy.py (EvaluateScriptTestCase.testEvaluateInt1)
  (EvaluateScriptTestCase.testEvaluateInt3): Check that returned integers
  are actually of type int.

62. By Martín Soto <soto@masoft> on 2009-11-28

Add wrapper caching for the Python-wrapped-in-JavaScript direction

* javascriptcore.pyx (_pyWrappedPyObjs): New dictionary to cache
  JavaScript wrappers for Python objects.
  (wrapJSObject): Fix declaration of 'wrapper' variable.
  (wrapPyObject): New procedure to wrap Python objects into
  JavaScript. This uses the wrapper cache.
  (pythonToJS): Call wrapPyObject when wrapping objects.
  (finalizeCb): Remove wrappers from the cache when they are
  (_cachedStats): Add number of cached JavaSript wrappers to the returned

* test/pyfromjs.py (WrapUnwrapTestCase.testIdentity1)
  (WrapUnwrapTestCase.testIdentity2): New tests to make sure that the
  same Python object always gets the same wrapper.

* test/test.py: Make sure no wrappers remain cached after the tests are

61. By Martín Soto <soto@masoft> on 2009-11-28

Add PyCObject_FromVoidPtr to python.pyi

* python.pyi: Cleaned up. Added declaration for PyCObject_FromVoidPtr.

60. By Martín Soto <soto@masoft> on 2009-11-28

Add wrapper caching for the JavaScript-wrapped-in-Python direction

* javascriptcore.pyx (_pyWrappedJSObjs, wrapJSObject): New dictionary and
  function to cache the wrappers of JavaScript objects so that objects
  are not wrapped twice.
  (jsToPython): Use the object wrapping implementation.
  (_JSBaseObject.__weakref__): New attribute. Makes it possible to have
  weak references to wrappers.
  (_cachedStats): New debugging function. For the moment, it returns a
  dictionary containing the number of objects currently cached in

* test/jsfrompy.py (WrapUnwrapTestCase.testIdentity1)
  (WrapUnwrapTestCase.testCachedWrappers1): Test the caching mechanism.

* test/test.py: Verify that no objects remain in the cache after running
  the tests.

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
This branch contains Public information 
Everyone can see this information.