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

Function all_contained_in

src/JSObjectValuesProxy.cc:61–89  ·  view source on GitHub ↗

private

Source from the content-addressed store, hash-verified

59
60// private
61static int all_contained_in(PyObject *self, PyObject *other) {
62 PyObject *iter = PyObject_GetIter(self);
63 int ok = 1;
64
65 if (iter == NULL) {
66 return -1;
67 }
68
69 for (;; ) {
70 PyObject *next = PyIter_Next(iter);
71 if (next == NULL) {
72 if (PyErr_Occurred())
73 ok = -1;
74 break;
75 }
76 if (PyObject_TypeCheck(other, &JSObjectValuesProxyType)) {
77 JSObjectValuesProxyMethodDefinitions::JSObjectValuesProxy_contains((JSObjectValuesProxy *)other, next);
78 }
79 else {
80 ok = PySequence_Contains(other, next);
81 }
82 Py_DECREF(next);
83 if (ok <= 0)
84 break;
85 }
86
87 Py_DECREF(iter);
88 return ok;
89}
90
91PyObject *JSObjectValuesProxyMethodDefinitions::JSObjectValuesProxy_iter(JSObjectValuesProxy *self) {
92 JSObjectIterProxy *iterator = PyObject_GC_New(JSObjectIterProxy, &JSObjectIterProxyType);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected