Esempio n. 1
0
static int PyPointlessVector_contains(PyPointlessVector* self, PyObject* b)
{
	uint32_t i, c;
	pointless_complete_value_t v;
	const char* error = 0;

	for (i = 0; i < self->slice_n; i++) {
		v = pointless_reader_vector_value_case(&self->pp->p, self->v, i + self->slice_i);
		c = pypointless_cmp_eq(&self->pp->p, &v, b, &error);

		if (error) {
			PyErr_Format(PyExc_ValueError, "comparison error: %s", error);
			return -1;
		}

		if (c)
			return 1;
	}

	return 0;
}
Esempio n. 2
0
static uint32_t PyPointlessSet_eq_cb(pointless_t* p, pointless_complete_value_t* v, void* user, const char** error)
{
	return pypointless_cmp_eq(p, v, (PyObject*)user, error);
}