示例#1
0
文件: object.c 项目: fdr/pg-python
	NULL,									/* tp_iter */
	NULL,									/* tp_iternext */
	NULL,									/* tp_methods */
	PyPgObject_Members,						/* tp_members */
	NULL,									/* tp_getset */
	NULL,									/* tp_base */
	NULL,									/* tp_dict */
	NULL,									/* tp_descr_get */
	NULL,									/* tp_descr_set */
	0,										/* tp_dictoffset */
	NULL,									/* tp_init */
	NULL,									/* tp_alloc */
	obj_new,								/* tp_new */
	NULL,									/* tp_free */
},
	PYPG_INIT_TYPINFO(invalid)
};

PyObj
PyPgObject_Initialize(PyObj self, Datum d)
{
	PyPgTypeInfo typinfo = PyPgTypeInfo(Py_TYPE(self));
	MemoryContext former = CurrentMemoryContext;

	MemoryContextSwitchTo(PythonMemoryContext);
	d = Py_datumCopy(d, typinfo->typbyval, typinfo->typlen);
	MemoryContextSwitchTo(former);

	if (!typinfo->typbyval && !PointerIsValid(DatumGetPointer(d)))
	{
		Py_DECREF(self);
示例#2
0
文件: pseudo.c 项目: fdr/pg-python
	0,												/* tp_weaklistoffset */
	NULL,											/* tp_iter */
	NULL,											/* tp_iternext */
	NULL,											/* tp_methods */
	NULL,											/* tp_members */
	NULL,											/* tp_getset */
	(PyTypeObject *) &PyPgObject_Type,				/* tp_base */
	NULL,											/* tp_dict */
	NULL,											/* tp_descr_get */
	NULL,											/* tp_descr_set */
	0,												/* tp_dictoffset */
	NULL,											/* tp_init */
	NULL,											/* tp_alloc */
	pseudo_new,										/* tp_new */
},
	PYPG_INIT_TYPINFO(invalid)
};

PyObj PyPg_void_object = NULL;
static PyObj
void_new(PyTypeObject *subtype, PyObj args, PyObj kw)
{
	static char *kwlist[] = {NULL};
	PyObj ob;

	Assert(subtype != NULL);

	if (!PyArg_ParseTupleAndKeywords(args, kw, "O", kwlist, &ob))
		return(NULL);

	Assert(ob != NULL);
示例#3
0
	&array_as_mapping,								/* tp_as_mapping */
	NULL,											/* tp_hash */
	NULL,											/* tp_call */
	NULL,											/* tp_str */
	NULL,											/* tp_getattro */
	NULL,											/* tp_setattro */
	NULL,											/* tp_as_buffer */
	Py_TPFLAGS_DEFAULT|
	Py_TPFLAGS_BASETYPE,							/* tp_flags */
	PyPgArray_Type_Doc,								/* tp_doc */
	NULL,											/* tp_traverse */
	NULL,											/* tp_clear */
	NULL,											/* tp_richcompare */
	0,												/* tp_weaklistoffset */
	PySeqIter_New,									/* tp_iter */
	NULL,											/* tp_iternext */
	array_methods,									/* tp_methods */
	NULL,											/* tp_members */
	array_getset,									/* tp_getset */
	(PyTypeObject *) &PyPgObject_Type,				/* tp_base */
	NULL,											/* tp_dict */
	NULL,											/* tp_descr_get */
	NULL,											/* tp_descr_set */
	0,												/* tp_dictoffset */
	NULL,											/* tp_init */
	NULL,											/* tp_alloc */
	NULL,											/* tp_new */
},
	PYPG_INIT_TYPINFO(ARRAY)
};