/**
 * \note doesn't actually check selection.
 */
int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
{
	BMesh *bm;
	Py_ssize_t value_len;
	Py_ssize_t i;
	BMElem **value_array = NULL;

	BPY_BM_CHECK_INT(self);

	bm = self->bm;

	value_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
	                                        &value_len, BM_VERT | BM_EDGE | BM_FACE,
	                                        TRUE, TRUE, "BMesh.select_history = value");

	if (value_array == NULL) {
		return -1;
	}

	BM_select_history_clear(bm);

	for (i = 0; i < value_len; i++) {
		BM_select_history_store_notest(bm, value_array[i]);
	}

	PyMem_FREE(value_array);
	return 0;
}
static Py_ssize_t bpy_bmlayercollection_length(BPy_BMLayerCollection *self)
{
	CustomData *data;

	BPY_BM_CHECK_INT(self);

	data = bpy_bm_customdata_get(self->bm, self->htype);

	return CustomData_number_of_layers(data, self->type);
}
static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value)
{
	BPy_BMElem *value_bm_ele;

	BPY_BM_CHECK_INT(self);

	value_bm_ele = (BPy_BMElem *)value;
	if (value_bm_ele->bm == self->bm) {
		return BM_select_history_check(self->bm, value_bm_ele->ele);
	}

	return 0;
}
static int bpy_bmlayercollection_contains(BPy_BMLayerCollection *self, PyObject *value)
{
	const char *keyname = _PyUnicode_AsString(value);
	CustomData *data;
	int index;

	BPY_BM_CHECK_INT(self);

	if (keyname == NULL) {
		PyErr_SetString(PyExc_TypeError,
		                "BMLayerCollection.__contains__: expected a string");
		return -1;
	}

	data = bpy_bm_customdata_get(self->bm, self->htype);
	index = CustomData_get_named_layer_index(data, self->type, keyname);

	return (index != -1) ? 1 : 0;
}
static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq *self)
{
	BPY_BM_CHECK_INT(self);

	return BLI_countlist(&self->bm->selected);
}