[capi-sig] Create new object

Shaun Savage savages at mozapps.org
Mon Jul 27 21:58:31 CEST 2009


I am trying to create a new python object of type  Foo from a C program.

typedef struct (
    PyObject_HEAD
    PyObject ....,
...
} Foo;

static PyTypeObject FooType = {
    PyObject_HEAD_INIT(NULL)
    0,
    "foo.Foo",
    sizeof(Foo),
0,
...
}

in the code i have

self = (Foo*) PyObject_CallObject((PyObject*)&FooType, NULL);
if (self == NULL)

It segFaults
when a change the args to Py_None it returns NULL

I have tried to create empty tuple args

nothing works

Any Ideas?

shaun





More information about the capi-sig mailing list