[capi-sig] Create instance given its type
gagsl-py2 at yahoo.com.ar
Fri Jan 8 17:45:02 CET 2010
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). So this is what I'm doing now:
obj = (MyFooObject *) PyObject_CallMethod((PyObject *)&PyType_Type, "__call__", "OOO", &MyFooType, other, arguments);
where MyFooType is a PyTypeObject struct. Ok, it works, but I'm pretty sure there is a more direct way - but how?
Encontra las mejores recetas con Yahoo! Cocina.
More information about the capi-sig