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

Method getOwnPropertyDescriptor

src/PyObjectProxyHandler.cc:139–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139bool PyObjectProxyHandler::getOwnPropertyDescriptor(
140 JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
141 JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc
142) const {
143 PyObject *attrName = idToKey(cx, id);
144 PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
145 PyObject *item = PyObject_GetAttr(self, attrName);
146 if (!item && PyErr_ExceptionMatches(PyExc_AttributeError)) {
147 PyErr_Clear(); // clear error, we will be returning undefined in this case
148 }
149
150 return handleGetOwnPropertyDescriptor(cx, id, desc, item);
151}
152
153bool PyObjectProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleId id,
154 JS::HandleValue v, JS::HandleValue receiver,

Callers

nothing calls this directly

Calls 1

idToKeyFunction · 0.85

Tested by

no test coverage detected