[Pyrex] How to efficiently construct an extension instance from Pyrex?

Gary Bishop gb at cs.unc.edu
Sun Apr 18 19:36:32 CEST 2004


I'm making an extension type with Pyrex and having a good time! My 
__init__ method offers a lot of flexibility with several argument 
variations for the Python user.

My problem is that I also need to construct objects from within my 
Pyrex methods. I'd like these constructions with VERY simple arguments 
to be efficient.

Can I have a constructor that I use from Pyrex and a different one I 
use from Python? I've experimented a bit with PyInstance_NewRaw but 
with no success. It seems to me that calling 
PyInstance_NewRaw(self.__class__,0) ought to create a new instance of 
the same class as the current object but it fails with "bad argument to 
internal function call".

Other suggestions for efficiently creating extension objects from within Pyrex?

Thanks
gb




More information about the Pyrex mailing list