[capi-sig] Create instance given its type

Stefan Behnel python_capi at behnel.de
Fri Jan 8 19:03:12 CET 2010


Gabriel Genellina, 08.01.2010 17:45:
> I want to create an instance given its type object. I expected that
> calling the type would be enough, something like this:
> 
> obj = (MyFooObject *) PyObject_CallFunctionObjArgs(&MyFooType, other, arguments, NULL)
> 
> but it doesn't work (nor even compiles, I think).

You think? Didn't you try it?

You might have to cast the type pointer to PyObject* to make it work.

Stefan


More information about the capi-sig mailing list