MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / JSObjectProxy_ior

Method JSObjectProxy_ior

src/JSObjectProxy.cc:590–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_ior(JSObjectProxy *self, PyObject *other) {
591 if (PyDict_Check(other)) {
592 JS::Rooted<JS::ValueArray<2>> args(GLOBAL_CX);
593 args[0].setObjectOrNull(*(self->jsObject));
594 JS::RootedValue jValueOther(GLOBAL_CX, jsTypeFactory(GLOBAL_CX, other));
595 args[1].setObject(jValueOther.toObject());
596
597 JS::RootedObject global(GLOBAL_CX, JS::GetNonCCWObjectGlobal(*(self->jsObject)));
598
599 // call Object.assign
600 JS::RootedValue Object(GLOBAL_CX);
601 if (!JS_GetProperty(GLOBAL_CX, global, "Object", &Object)) {
602 PyErr_Format(PyExc_SystemError, "%s JSAPI call failed", JSObjectProxyType.tp_name);
603 return NULL;
604 }
605
606 JS::RootedObject rootedObject(GLOBAL_CX, Object.toObjectOrNull());
607 JS::RootedValue ret(GLOBAL_CX);
608 if (!JS_CallFunctionName(GLOBAL_CX, rootedObject, "assign", args, &ret)) {
609 PyErr_Format(PyExc_SystemError, "%s JSAPI call failed", JSObjectProxyType.tp_name);
610 return NULL;
611 }
612 }
613 else {
614 if (mergeFromSeq2(self, other) < 0) {
615 return NULL;
616 }
617 }
618
619 Py_INCREF(self);
620 return (PyObject *)self;
621}
622
623PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_get_method(JSObjectProxy *self, PyObject *const *args, Py_ssize_t nargs) {
624 PyObject *key;

Callers

nothing calls this directly

Calls 2

jsTypeFactoryFunction · 0.85
mergeFromSeq2Function · 0.85

Tested by

no test coverage detected