lp:~fredreichbier/+junk/pyjavascriptcore

Created by Friedrich Weber and last modified
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

Owner:
Friedrich Weber
Status:
Development

Recent revisions

69. By Friedrich Weber <fred@klops>

Added some casts to make Cython 0.13 happy.

68. By Friedrich Weber <fred@klops>

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

67. By Martín Soto <soto@masoft>

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>

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>

Rename finalizeCb function for consistency

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

64. By Martín Soto <soto@masoft>

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
#554299
) for pointing this out.

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

63. By Martín Soto <soto@masoft>

 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.testEvaluateInt2)
  (EvaluateScriptTestCase.testEvaluateInt3): Check that returned integers
  are actually of type int.

62. By Martín Soto <soto@masoft>

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
  garbage-collected.
  (_cachedStats): Add number of cached JavaSript wrappers to the returned
  stats.

* 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
  run.

61. By Martín Soto <soto@masoft>

Add PyCObject_FromVoidPtr to python.pyi

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

60. By Martín Soto <soto@masoft>

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
  _pyWrappedJSObjs.

* test/jsfrompy.py (WrapUnwrapTestCase.testIdentity1)
  (WrapUnwrapTestCase.testIdentity2)
  (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.

Subscribers