@@ -60,23 +60,17 @@ PyObject *JSArrayProxyMethodDefinitions::JSArrayProxy_get(JSArrayProxy *self, Py
6060 // look through the methods for dispatch and return key if no method found
6161 for (size_t index = 0 ;; index++) {
6262 const char *methodName = JSArrayProxyType.tp_methods [index].ml_name ;
63- if (methodName == NULL ) { // reached end of list
63+ if (methodName == NULL || ! PyUnicode_Check (key) ) { // reached end of list
6464 JS::RootedValue *value = new JS::RootedValue (GLOBAL_CX);
6565 JS_GetPropertyById (GLOBAL_CX, self->jsArray , id, value);
66- JS::RootedObject *global = new JS::RootedObject (GLOBAL_CX, JS::GetNonCCWObjectGlobal ( self->jsArray ) );
67- return pyTypeFactory (GLOBAL_CX, global , value)->getPyObject ();
66+ JS::RootedObject *thisObj = new JS::RootedObject (GLOBAL_CX, self->jsArray );
67+ return pyTypeFactory (GLOBAL_CX, thisObj , value)->getPyObject ();
6868 }
69- else if ( PyUnicode_Check (key)) {
69+ else {
7070 if (strcmp (methodName, PyUnicode_AsUTF8 (key)) == 0 ) {
7171 return PyObject_GenericGetAttr ((PyObject *)self, key);
7272 }
7373 }
74- else {
75- JS::RootedValue *value = new JS::RootedValue (GLOBAL_CX);
76- JS_GetPropertyById (GLOBAL_CX, self->jsArray , id, value);
77- JS::RootedObject *global = new JS::RootedObject (GLOBAL_CX, JS::GetNonCCWObjectGlobal (self->jsArray ));
78- return pyTypeFactory (GLOBAL_CX, global, value)->getPyObject ();
79- }
8074 }
8175}
8276
0 commit comments