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

Function all_contained_in

src/JSObjectKeysProxy.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, &JSObjectKeysProxyType)) {
77 JSObjectKeysProxyMethodDefinitions::JSObjectKeysProxy_contains((JSObjectKeysProxy *)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 *JSObjectKeysProxyMethodDefinitions::JSObjectKeysProxy_richcompare(JSObjectKeysProxy *self, PyObject *other, int op) {
92 Py_ssize_t len_self, len_other;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected