lp:pyjavascriptcore

Created by Martin Soto on 2009-11-02 and last modified on 2010-04-06
Get this branch:
bzr branch lp:pyjavascriptcore
Only Martin Soto can upload to this branch. If you are Martin Soto please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Martin Soto
Project:
PyJavaScriptCore
Status:
Development

Recent revisions

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
#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> 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.testEvaluateInt2)
  (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
  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> 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
  _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.

59. By Martín Soto <soto@masoft> on 2009-11-24

Clean up example browser

* examples/searchpage.py (WebView): Renamed from testbrowser.py. Clean up
  structure and document the cool tricks we can do with PyJavaScriptCore.

58. By Martín Soto <soto@masoft> on 2009-11-24

JSFunction and JSBoundMethod now implement the full mapping protocol

* javascriptcore.pyx (_JSFunction): Renamed from JSFunction.
  (JSFunction): New class to mix _JSFunction with
  collections.MutableMapping.
  (_JSBoundMethod): Renamed from JSBoundMethod. Attribute thisObject
  renamed to jsThisObject.
  (JSBoundMethod): New class to mix _JSBoundMethod with
  collections.MutableMapping.

* test/pyfromjs.py (FunctionMappingTestCase): Test all mapping operations
  on a function object.

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