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

Method JSObjectProxy_iter

src/JSObjectProxy.cc:288–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_iter(JSObjectProxy *self) {
289 // key iteration
290 JSObjectIterProxy *iterator = PyObject_GC_New(JSObjectIterProxy, &JSObjectIterProxyType);
291 if (iterator == NULL) {
292 return NULL;
293 }
294 iterator->it.it_index = 0;
295 iterator->it.reversed = false;
296 iterator->it.kind = KIND_KEYS;
297 Py_INCREF(self);
298 iterator->it.di_dict = (PyDictObject *)self;
299 iterator->it.props = new JS::PersistentRootedIdVector(GLOBAL_CX);
300 // Get **enumerable** own properties
301 if (!js::GetPropertyKeys(GLOBAL_CX, *(self->jsObject), JSITER_OWNONLY, iterator->it.props)) {
302 return NULL;
303 }
304 PyObject_GC_Track(iterator);
305 return (PyObject *)iterator;
306}
307
308PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_iter_next(JSObjectProxy *self) {
309 PyObject *key = PyUnicode_FromString("next");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected