create a new instance in C of a Python subclass

Thomas Heller theller at
Tue Apr 15 20:50:32 CEST 2003

Paul Miller <paul at> writes:

> I've got a C extension type that is subclassed in Python. In C, I want to
> create a new instace of the subclass, which I have a pointer to. What
> magical incantation will allow this? I'm assuming some combination of
> PyObject_New and PyObject_Init are required, using the ob->ob_type pointer?

You do the same as in Python: call the type.

Does this help?


More information about the Python-list mailing list