コード例 #1
0
ファイル: descrobject.c プロジェクト: develersrl/dspython
static int
member_set(PyMemberDescrObject *descr, PyObject *obj, PyObject *value)
{
	int res;

	if (descr_setcheck((PyDescrObject *)descr, obj, value, &res))
		return res;
	return PyMember_SetOne((char *)obj, descr->d_member, value);
}
コード例 #2
0
ファイル: structmember.c プロジェクト: MatiasNAmendola/cleese
int
PyMember_Set(char *addr, struct memberlist *mlist, char *name, PyObject *v)
{
	struct memberlist *l;

	for (l = mlist; l->name != NULL; l++) {
		if (strcmp(l->name, name) == 0) {
			PyMemberDef copy;
			copy.name = l->name;
			copy.type = l->type;
			copy.offset = l->offset;
			copy.flags = l->flags;
			copy.doc = NULL;
			return PyMember_SetOne(addr, &copy, v);
		}
	}

	PyErr_SetString(PyExc_AttributeError, name);
	return -1;
}
コード例 #3
0
ファイル: _drizzle.c プロジェクト: LinuxJedi/MyDrizzle-python
static PyObject *_drizzle_ConnectionObject_setattr(
        _drizzle_ConnectionObject *self,
        char *name,
        PyObject *v)
{
    if (v == NULL)
    {
        PyErr_SetString(PyExc_AttributeError,
                "can't delete connection attributes");
        return -1;
    }

    PyMemberDef *l;
    for (l = _drizzle_ConnectionObject_memberlist; l->name != NULL; l++)
    {
        if (strcmp(l->name, name) == 0)
        {
            return PyMember_SetOne((char *)self, l, v);
        }
    }
    PyErr_SetString(PyExc_AttributeError, name);
    return -1;
}