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

Method delete_

src/PyListProxyHandler.cc:2154–2166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2152}
2153
2154bool PyListProxyHandler::delete_(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::ObjectOpResult &result) const {
2155 Py_ssize_t index;
2156 PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
2157 if (!idToIndex(cx, id, &index)) {
2158 return result.failBadIndex();
2159 }
2160
2161 // Set to undefined instead of actually deleting it
2162 if (PyList_SetItem(self, index, Py_None) < 0) {
2163 return result.failCantDelete();
2164 }
2165 return result.succeed();
2166}
2167
2168bool PyListProxyHandler::isArray(JSContext *cx, JS::HandleObject proxy, JS::IsArrayAnswer *answer) const {
2169 *answer = JS::IsArrayAnswer::Array;

Callers

nothing calls this directly

Calls 1

idToIndexFunction · 0.85

Tested by

no test coverage detected