return (PyObject*)myPyType; ...segmentation fault!

elho eh1 at delair.de
Fri Sep 30 07:04:35 EDT 2005


> > It is said that the object has a NULL-Pointer when I try to debug it?
> what object?
   the python one  'myNewPyType'



Sorry, I forgot to change:
   PySDLXMLNodeType = PyMyType
..above the corrections

// == PyMyExtention.c =================================================
.
:
typedef struct {
    PyObject_HEAD
    long lAttribute;
} PyMyObject;

static PyObject* PyMyObject_NewC (long lAttribute)
{
    PyMyObject *self;
    PyMyObject *type;

    self = new PyMyObject
    self->lAttribute = lAttribute;

    return (PyObject*)self;
}

static PyMethodDef PyMyObject_methods[] = {
    {"PyMyObject_NewC", (PyCFunction)PyMyObject_NewC, METH_NOARGS,
    "Create PyMyObject_NewC from C-Code"},
    {NULL}  /* Sentinel */
};

:

static PyTypeObject PyMyType = {
    PyObject_HEAD_INIT(NULL)
    :
};
//===================================================================/




More information about the Python-list mailing list