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

Method handleOwnPropertyKeys

src/PyObjectProxyHandler.cc:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26const char PyObjectProxyHandler::family = 0;
27
28bool PyObjectProxyHandler::handleOwnPropertyKeys(JSContext *cx, PyObject *keys, size_t length, JS::MutableHandleIdVector props) {
29 if (!props.reserve(length)) {
30 return false; // out of memory
31 }
32
33 for (size_t i = 0; i < length; i++) {
34 PyObject *key = PyList_GetItem(keys, i);
35 JS::RootedId jsId(cx);
36 if (!keyToId(key, &jsId)) {
37 continue; // skip over keys that are not str or int
38 }
39 props.infallibleAppend(jsId);
40 }
41 return true;
42}
43
44bool PyObjectProxyHandler::handleGetOwnPropertyDescriptor(JSContext *cx, JS::HandleId id,
45 JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc, PyObject *item) {

Callers

nothing calls this directly

Calls 1

keyToIdFunction · 0.85

Tested by

no test coverage detected