Commits

Anonymous committed b23e407

Another callable function test.

  • Participants
  • Parent commits 4efbab4

Comments (0)

Files changed (3)

File spidermonkey.c

-/* Generated by Pyrex 0.9.8.5 on Thu Jan 22 23:16:14 2009 */
+/* Generated by Pyrex 0.9.8.5 on Fri Jan 23 00:47:23 2009 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 static char __pyx_k62[] = "js_name";
 static char __pyx_k63[] = "__name__";
 static char __pyx_k64[] = "%s js_name attribute is not string-like";
-static char __pyx_k65[] = "Value is not a function: %s";
-static char __pyx_k66[] = "couldn't get JS constructor";
-static char __pyx_k67[] = "js_constructor";
-static char __pyx_k68[] = "func_name";
-static char __pyx_k69[] = "StringType";
-static char __pyx_k70[] = "MethodType";
-static char __pyx_k71[] = "bind_callable";
-static char __pyx_k72[] = "bind_attribute";
-static char __pyx_k73[] = "startswith";
-static char __pyx_k74[] = "_";
-static char __pyx_k75[] = "Illegal key: %s";
-static char __pyx_k76[] = "Didn't expect key: %s";
-static char __pyx_k77[] = "isfloat";
-static char __pyx_k78[] = "can't create new double";
-static char __pyx_k79[] = "can't create new string";
-static char __pyx_k80[] = "ismapping";
-static char __pyx_k81[] = "can't create new object";
-static char __pyx_k82[] = "iteritems";
-static char __pyx_k83[] = "can't define property";
-static char __pyx_k84[] = "issequence";
-static char __pyx_k85[] = "can't create new array object";
-static char __pyx_k86[] = "can't define element";
-static char __pyx_k87[] = "FunctionType";
-static char __pyx_k88[] = "LambdaType";
-static char __pyx_k89[] = "couldn't look up or create new object";
-static char __pyx_k90[] = "can't happen";
-static char __pyx_k91[] = "unknown primitive type";
-static char __pyx_k92[] = "cStringIO";
-static char __pyx_k93[] = "types";
-static char __pyx_k94[] = "InstanceType";
+static char __pyx_k65[] = "Failed to execute function: %s";
+static char __pyx_k66[] = "Value is not a function: %s";
+static char __pyx_k67[] = "couldn't get JS constructor";
+static char __pyx_k68[] = "js_constructor";
+static char __pyx_k69[] = "func_name";
+static char __pyx_k70[] = "StringType";
+static char __pyx_k71[] = "MethodType";
+static char __pyx_k72[] = "bind_callable";
+static char __pyx_k73[] = "bind_attribute";
+static char __pyx_k74[] = "startswith";
+static char __pyx_k75[] = "_";
+static char __pyx_k76[] = "Illegal key: %s";
+static char __pyx_k77[] = "Didn't expect key: %s";
+static char __pyx_k78[] = "isfloat";
+static char __pyx_k79[] = "can't create new double";
+static char __pyx_k80[] = "can't create new string";
+static char __pyx_k81[] = "ismapping";
+static char __pyx_k82[] = "can't create new object";
+static char __pyx_k83[] = "iteritems";
+static char __pyx_k84[] = "can't define property";
+static char __pyx_k85[] = "issequence";
+static char __pyx_k86[] = "can't create new array object";
+static char __pyx_k87[] = "can't define element";
+static char __pyx_k88[] = "FunctionType";
+static char __pyx_k89[] = "LambdaType";
+static char __pyx_k90[] = "couldn't look up or create new object";
+static char __pyx_k91[] = "can't happen";
+static char __pyx_k92[] = "unknown primitive type";
+static char __pyx_k93[] = "cStringIO";
+static char __pyx_k94[] = "types";
+static char __pyx_k95[] = "InstanceType";
 
 static PyObject *__pyx_n_AttributeError;
 static PyObject *__pyx_n_DictType;
 static PyObject *__pyx_k64p;
 static PyObject *__pyx_k65p;
 static PyObject *__pyx_k66p;
-static PyObject *__pyx_k75p;
+static PyObject *__pyx_k67p;
 static PyObject *__pyx_k76p;
-static PyObject *__pyx_k78p;
+static PyObject *__pyx_k77p;
 static PyObject *__pyx_k79p;
-static PyObject *__pyx_k81p;
-static PyObject *__pyx_k83p;
-static PyObject *__pyx_k85p;
+static PyObject *__pyx_k80p;
+static PyObject *__pyx_k82p;
+static PyObject *__pyx_k84p;
 static PyObject *__pyx_k86p;
-static PyObject *__pyx_k89p;
+static PyObject *__pyx_k87p;
 static PyObject *__pyx_k90p;
 static PyObject *__pyx_k91p;
+static PyObject *__pyx_k92p;
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_AttributeError, 1, __pyx_k60, sizeof(__pyx_k60)},
   {&__pyx_n_DictType, 1, __pyx_k8, sizeof(__pyx_k8)},
   {&__pyx_n_FloatType, 1, __pyx_k5, sizeof(__pyx_k5)},
-  {&__pyx_n_FunctionType, 1, __pyx_k87, sizeof(__pyx_k87)},
-  {&__pyx_n_InstanceType, 1, __pyx_k94, sizeof(__pyx_k94)},
+  {&__pyx_n_FunctionType, 1, __pyx_k88, sizeof(__pyx_k88)},
+  {&__pyx_n_InstanceType, 1, __pyx_k95, sizeof(__pyx_k95)},
   {&__pyx_n_IntType, 1, __pyx_k3, sizeof(__pyx_k3)},
   {&__pyx_n_JSError, 1, __pyx_k53, sizeof(__pyx_k53)},
-  {&__pyx_n_LambdaType, 1, __pyx_k88, sizeof(__pyx_k88)},
+  {&__pyx_n_LambdaType, 1, __pyx_k89, sizeof(__pyx_k89)},
   {&__pyx_n_ListType, 1, __pyx_k7, sizeof(__pyx_k7)},
   {&__pyx_n_LongType, 1, __pyx_k4, sizeof(__pyx_k4)},
-  {&__pyx_n_MethodType, 1, __pyx_k70, sizeof(__pyx_k70)},
+  {&__pyx_n_MethodType, 1, __pyx_k71, sizeof(__pyx_k71)},
   {&__pyx_n_RUNTIMES, 1, __pyx_k22, sizeof(__pyx_k22)},
   {&__pyx_n_StringIO, 1, __pyx_k9, sizeof(__pyx_k9)},
-  {&__pyx_n_StringType, 1, __pyx_k69, sizeof(__pyx_k69)},
+  {&__pyx_n_StringType, 1, __pyx_k70, sizeof(__pyx_k70)},
   {&__pyx_n_StringTypes, 1, __pyx_k6, sizeof(__pyx_k6)},
   {&__pyx_n_TupleType, 1, __pyx_k1, sizeof(__pyx_k1)},
-  {&__pyx_n__, 1, __pyx_k74, sizeof(__pyx_k74)},
+  {&__pyx_n__, 1, __pyx_k75, sizeof(__pyx_k75)},
   {&__pyx_n___class__, 1, __pyx_k31, sizeof(__pyx_k31)},
   {&__pyx_n___name__, 1, __pyx_k63, sizeof(__pyx_k63)},
   {&__pyx_n_append, 1, __pyx_k25, sizeof(__pyx_k25)},
-  {&__pyx_n_bind_attribute, 1, __pyx_k72, sizeof(__pyx_k72)},
-  {&__pyx_n_bind_callable, 1, __pyx_k71, sizeof(__pyx_k71)},
+  {&__pyx_n_bind_attribute, 1, __pyx_k73, sizeof(__pyx_k73)},
+  {&__pyx_n_bind_callable, 1, __pyx_k72, sizeof(__pyx_k72)},
   {&__pyx_n_bind_class, 1, __pyx_k30, sizeof(__pyx_k30)},
-  {&__pyx_n_cStringIO, 1, __pyx_k92, sizeof(__pyx_k92)},
+  {&__pyx_n_cStringIO, 1, __pyx_k93, sizeof(__pyx_k93)},
   {&__pyx_n_callable, 1, __pyx_k40, sizeof(__pyx_k40)},
   {&__pyx_n_compat_isinstance, 1, __pyx_k2, sizeof(__pyx_k2)},
   {&__pyx_n_extend, 1, __pyx_k49, sizeof(__pyx_k49)},
   {&__pyx_n_finish_initialization, 1, __pyx_k26, sizeof(__pyx_k26)},
-  {&__pyx_n_func_name, 1, __pyx_k68, sizeof(__pyx_k68)},
+  {&__pyx_n_func_name, 1, __pyx_k69, sizeof(__pyx_k69)},
   {&__pyx_n_getvalue, 1, __pyx_k12, sizeof(__pyx_k12)},
   {&__pyx_n_inspect, 1, __pyx_k42, sizeof(__pyx_k42)},
   {&__pyx_n_isclass, 1, __pyx_k43, sizeof(__pyx_k43)},
-  {&__pyx_n_isfloat, 1, __pyx_k77, sizeof(__pyx_k77)},
+  {&__pyx_n_isfloat, 1, __pyx_k78, sizeof(__pyx_k78)},
   {&__pyx_n_isinteger, 1, __pyx_k45, sizeof(__pyx_k45)},
-  {&__pyx_n_ismapping, 1, __pyx_k80, sizeof(__pyx_k80)},
-  {&__pyx_n_issequence, 1, __pyx_k84, sizeof(__pyx_k84)},
+  {&__pyx_n_ismapping, 1, __pyx_k81, sizeof(__pyx_k81)},
+  {&__pyx_n_issequence, 1, __pyx_k85, sizeof(__pyx_k85)},
   {&__pyx_n_isstringlike, 1, __pyx_k36, sizeof(__pyx_k36)},
-  {&__pyx_n_iteritems, 1, __pyx_k82, sizeof(__pyx_k82)},
+  {&__pyx_n_iteritems, 1, __pyx_k83, sizeof(__pyx_k83)},
   {&__pyx_n_js_classname, 1, __pyx_k32, sizeof(__pyx_k32)},
-  {&__pyx_n_js_constructor, 1, __pyx_k67, sizeof(__pyx_k67)},
+  {&__pyx_n_js_constructor, 1, __pyx_k68, sizeof(__pyx_k68)},
   {&__pyx_n_js_name, 1, __pyx_k62, sizeof(__pyx_k62)},
   {&__pyx_n_max, 1, __pyx_k17, sizeof(__pyx_k17)},
   {&__pyx_n_min, 1, __pyx_k18, sizeof(__pyx_k18)},
   {&__pyx_n_remove, 1, __pyx_k55, sizeof(__pyx_k55)},
   {&__pyx_n_rt, 1, __pyx_k28, sizeof(__pyx_k28)},
   {&__pyx_n_split, 1, __pyx_k50, sizeof(__pyx_k50)},
-  {&__pyx_n_startswith, 1, __pyx_k73, sizeof(__pyx_k73)},
+  {&__pyx_n_startswith, 1, __pyx_k74, sizeof(__pyx_k74)},
   {&__pyx_n_stderr, 1, __pyx_k14, sizeof(__pyx_k14)},
   {&__pyx_n_sys, 1, __pyx_k13, sizeof(__pyx_k13)},
   {&__pyx_n_traceback, 1, __pyx_k10, sizeof(__pyx_k10)},
-  {&__pyx_n_types, 1, __pyx_k93, sizeof(__pyx_k93)},
+  {&__pyx_n_types, 1, __pyx_k94, sizeof(__pyx_k94)},
   {&__pyx_n_write, 1, __pyx_k15, sizeof(__pyx_k15)},
   {&__pyx_k16p, 0, __pyx_k16, sizeof(__pyx_k16)},
   {&__pyx_k19p, 0, __pyx_k19, sizeof(__pyx_k19)},
   {&__pyx_k64p, 0, __pyx_k64, sizeof(__pyx_k64)},
   {&__pyx_k65p, 0, __pyx_k65, sizeof(__pyx_k65)},
   {&__pyx_k66p, 0, __pyx_k66, sizeof(__pyx_k66)},
-  {&__pyx_k75p, 0, __pyx_k75, sizeof(__pyx_k75)},
+  {&__pyx_k67p, 0, __pyx_k67, sizeof(__pyx_k67)},
   {&__pyx_k76p, 0, __pyx_k76, sizeof(__pyx_k76)},
-  {&__pyx_k78p, 0, __pyx_k78, sizeof(__pyx_k78)},
+  {&__pyx_k77p, 0, __pyx_k77, sizeof(__pyx_k77)},
   {&__pyx_k79p, 0, __pyx_k79, sizeof(__pyx_k79)},
-  {&__pyx_k81p, 0, __pyx_k81, sizeof(__pyx_k81)},
-  {&__pyx_k83p, 0, __pyx_k83, sizeof(__pyx_k83)},
-  {&__pyx_k85p, 0, __pyx_k85, sizeof(__pyx_k85)},
+  {&__pyx_k80p, 0, __pyx_k80, sizeof(__pyx_k80)},
+  {&__pyx_k82p, 0, __pyx_k82, sizeof(__pyx_k82)},
+  {&__pyx_k84p, 0, __pyx_k84, sizeof(__pyx_k84)},
   {&__pyx_k86p, 0, __pyx_k86, sizeof(__pyx_k86)},
-  {&__pyx_k89p, 0, __pyx_k89, sizeof(__pyx_k89)},
+  {&__pyx_k87p, 0, __pyx_k87, sizeof(__pyx_k87)},
   {&__pyx_k90p, 0, __pyx_k90, sizeof(__pyx_k90)},
   {&__pyx_k91p, 0, __pyx_k91, sizeof(__pyx_k91)},
+  {&__pyx_k92p, 0, __pyx_k92, sizeof(__pyx_k92)},
   {0, 0, 0, 0}
 };
 
   __pyx_t_12spidermonkey_JSBool __pyx_10;
   int __pyx_11;
   int __pyx_12;
+  PyObject *__pyx_13 = 0;
   static char *__pyx_argnames[] = {0};
   if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0, 0) < 0) return 0;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) {
   __pyx_11 = PyObject_IsTrue(__pyx_v_ok); if (__pyx_11 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
   __pyx_12 = (!__pyx_11);
   if (__pyx_12) {
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
-    Py_INCREF(((struct __pyx_obj_12spidermonkey_ProxyFunction *)__pyx_v_self)->cx->_last_error);
-    PyTuple_SET_ITEM(__pyx_3, 0, ((struct __pyx_obj_12spidermonkey_ProxyFunction *)__pyx_v_self)->cx->_last_error);
-    __pyx_2 = PyObject_CallObject(PyExc_RuntimeError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
+    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_JSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
+    __pyx_2 = PyNumber_Remainder(__pyx_k65p, ((struct __pyx_obj_12spidermonkey_ProxyFunction *)__pyx_v_self)->cx->_last_error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
+    __pyx_13 = PyTuple_New(1); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
+    PyTuple_SET_ITEM(__pyx_13, 0, __pyx_2);
+    __pyx_2 = 0;
+    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_13); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_13); __pyx_13 = 0;
     __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
   __pyx_L1:;
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_13);
   __Pyx_AddTraceback("spidermonkey.ProxyFunction.__call__");
   __pyx_r = 0;
   __pyx_L0:;
   if (__pyx_1) {
     __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_JSError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
     __pyx_3 = PyInt_FromLong(JS_TypeOfValue(__pyx_v_cx->cx,__pyx_v_fun)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
-    __pyx_4 = PyNumber_Remainder(__pyx_k65p, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
+    __pyx_4 = PyNumber_Remainder(__pyx_k66p, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
   if (__pyx_1) {
 
     /* "/usr/local/src/python-spidermonkey/spidermonkey.pyx":841 */
-    Py_INCREF(__pyx_k66p);
+    Py_INCREF(__pyx_k67p);
     Py_DECREF(__pyx_v_msg);
-    __pyx_v_msg = __pyx_k66p;
+    __pyx_v_msg = __pyx_k67p;
 
     /* "/usr/local/src/python-spidermonkey/spidermonkey.pyx":842 */
     __pyx_2 = PyString_AsString(__pyx_v_msg); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; goto __pyx_L1;}
       goto __pyx_L4;
     }
     /*else*/ {
-      __pyx_2 = PyNumber_Remainder(__pyx_k75p, __pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; goto __pyx_L2;}
+      __pyx_2 = PyNumber_Remainder(__pyx_k76p, __pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; goto __pyx_L2;}
       __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; goto __pyx_L2;}
       PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
       __pyx_2 = 0;
       goto __pyx_L4;
     }
     /*else*/ {
-      __pyx_1 = PyNumber_Remainder(__pyx_k76p, __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L2;}
+      __pyx_1 = PyNumber_Remainder(__pyx_k77p, __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L2;}
       __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L2;}
       PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
       __pyx_1 = 0;
     __pyx_1 = (!JS_NewDoubleValue(__pyx_v_cx,__pyx_5,(&__pyx_v_rval)));
     if (__pyx_1) {
       __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
-      Py_INCREF(__pyx_k78p);
-      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k78p);
+      Py_INCREF(__pyx_k79p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k79p);
       __pyx_3 = PyObject_CallObject(PyExc_SystemError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
       Py_DECREF(__pyx_2); __pyx_2 = 0;
       __Pyx_Raise(__pyx_3, 0, 0);
     __pyx_1 = (__pyx_v_s == NULL);
     if (__pyx_1) {
       __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
-      Py_INCREF(__pyx_k79p);
-      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k79p);
+      Py_INCREF(__pyx_k80p);
+      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k80p);
       __pyx_2 = PyObject_CallObject(PyExc_SystemError, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
       Py_DECREF(__pyx_4); __pyx_4 = 0;
       __Pyx_Raise(__pyx_2, 0, 0);
     __pyx_1 = (__pyx_v_jsobj == NULL);
     if (__pyx_1) {
       __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; goto __pyx_L1;}
-      Py_INCREF(__pyx_k81p);
-      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);
+      Py_INCREF(__pyx_k82p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);
       __pyx_4 = PyObject_CallObject(PyExc_SystemError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; goto __pyx_L1;}
       Py_DECREF(__pyx_3); __pyx_3 = 0;
       __Pyx_Raise(__pyx_4, 0, 0);
         __pyx_9 = (!__pyx_1);
         if (__pyx_9) {
           __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; goto __pyx_L1;}
-          Py_INCREF(__pyx_k83p);
-          PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);
+          Py_INCREF(__pyx_k84p);
+          PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);
           __pyx_2 = PyObject_CallObject(PyExc_SystemError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; goto __pyx_L1;}
           Py_DECREF(__pyx_3); __pyx_3 = 0;
           __Pyx_Raise(__pyx_2, 0, 0);
     __pyx_9 = (__pyx_v_arr_obj == NULL);
     if (__pyx_9) {
       __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; goto __pyx_L1;}
-      Py_INCREF(__pyx_k85p);
-      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);
+      Py_INCREF(__pyx_k86p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);
       __pyx_2 = PyObject_CallObject(PyExc_SystemError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; goto __pyx_L1;}
       Py_DECREF(__pyx_3); __pyx_3 = 0;
       __Pyx_Raise(__pyx_2, 0, 0);
         __pyx_9 = (!__pyx_1);
         if (__pyx_9) {
           __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; goto __pyx_L1;}
-          Py_INCREF(__pyx_k86p);
-          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k86p);
+          Py_INCREF(__pyx_k87p);
+          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k87p);
           __pyx_4 = PyObject_CallObject(PyExc_SystemError, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; goto __pyx_L1;}
           Py_DECREF(__pyx_2); __pyx_2 = 0;
           __Pyx_Raise(__pyx_4, 0, 0);
       __pyx_9 = (__pyx_v_jsobj == NULL);
       if (__pyx_9) {
         __pyx_11 = PyTuple_New(1); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; goto __pyx_L1;}
-        Py_INCREF(__pyx_k89p);
-        PyTuple_SET_ITEM(__pyx_11, 0, __pyx_k89p);
+        Py_INCREF(__pyx_k90p);
+        PyTuple_SET_ITEM(__pyx_11, 0, __pyx_k90p);
         __pyx_12 = PyObject_CallObject(PyExc_SystemError, __pyx_11); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; goto __pyx_L1;}
         Py_DECREF(__pyx_11); __pyx_11 = 0;
         __Pyx_Raise(__pyx_12, 0, 0);
     }
     /*else*/ {
       __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; goto __pyx_L1;}
-      Py_INCREF(__pyx_k90p);
-      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k90p);
+      Py_INCREF(__pyx_k91p);
+      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k91p);
       __pyx_6 = PyObject_CallObject(PyExc_AssertionError, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; goto __pyx_L1;}
       Py_DECREF(__pyx_1); __pyx_1 = 0;
       __Pyx_Raise(__pyx_6, 0, 0);
   }
   /*else*/ {
     __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; goto __pyx_L1;}
-    Py_INCREF(__pyx_k91p);
-    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);
+    Py_INCREF(__pyx_k92p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);
     __pyx_4 = PyObject_CallObject(PyExc_SystemError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     __Pyx_Raise(__pyx_4, 0, 0);

File spidermonkey.pyx

             free(argv)
 
         if not ok:
-            raise RuntimeError(self.cx._last_error)
+            raise JSError("Failed to execute function: %s" % self.cx._last_error)
         retval = Py_from_JS(self.cx.cx, rval)
         JS_MaybeGC(self.cx.cx)
         return retval
     def test_scope(self):
         # multiple evaluations in a Context share same scope
         cx = self.cx
-        cx.eval_script("""\
-var x = 42;
-""")
+        cx.eval_script("var x = 42;")
         self.assert_(cx.eval_script("x;") == 42)
 
 class test_conversions_to_Python(TestCase):
 
     def test_construct(self):
         s = self.cx.eval_script("""\
-var s = new spam();
-s.foo(1, "blah", ["1", 2, "three"]);
-s;
-""")
+            var s = new spam();
+            s.foo(1, "blah", ["1", 2, "three"]);
+            s;
+        """)
         self.assert_(s.args.pop() == (1, "blah", ["1", 2, "three"]))
 
     def test_getsetitem(self):
         resp = self.cx.eval_script("function(val) {return val * 2;}")
         self.assertEqual(resp(2), 4)
 
+    def test_with_dict(self):
+        resp = self.cx.eval_script("function(doc) {if(doc.data) return doc.data;}")
+        self.assertEqual(resp({"data": 2}), 2)
+        self.assertEqual(resp({}), None)
+
 if __name__ == "__main__":
     unittest.main()