create a new instance in C of a Python subclass

Thomas Heller theller at python.net
Tue Apr 15 14:50:32 EDT 2003


Paul Miller <paul at fxtech.com> 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?

Thomas




More information about the Python-list mailing list