A
ajayre
I'm creating a type in a C function as follows:
static PyObject *Receive(PyObject *self, PyObject *args) {
pyMessageObject *msgobj = PyObject_New(pyMessageObject,
&pyMessageType);
return (PyObject *)msgobj;
}
I have (some lines omitted):
static PyTypeObject pyMessageType =
{
PyObject_HEAD_INIT(NULL)
...
pyMessage_Init, /*tp_init*/
0, /*tp_alloc*/
pyMessage_New, /*tp_new*/
};
I have noticed that pyMessage_New and pyMessage_Init are not called.
However if the type is created in Python then they are called. Why is
this and how can I solve it?
Thanks, Andy
(please reply to the newsgroup only - thanks)
static PyObject *Receive(PyObject *self, PyObject *args) {
pyMessageObject *msgobj = PyObject_New(pyMessageObject,
&pyMessageType);
return (PyObject *)msgobj;
}
I have (some lines omitted):
static PyTypeObject pyMessageType =
{
PyObject_HEAD_INIT(NULL)
...
pyMessage_Init, /*tp_init*/
0, /*tp_alloc*/
pyMessage_New, /*tp_new*/
};
I have noticed that pyMessage_New and pyMessage_Init are not called.
However if the type is created in Python then they are called. Why is
this and how can I solve it?
Thanks, Andy
(please reply to the newsgroup only - thanks)