[Pyrex] referencing the module object (__pyx_m aka module_cname)?

Yann Vernier yann at donkey.dyndns.org
Mon Nov 8 09:32:06 CET 2004


On Mon, Nov 08, 2004 at 02:26:51PM +1300, Greg Ewing wrote:
> Yann Vernier wrote:
> >On Sun, Nov 07, 2004 at 01:53:31PM -0500, Phillip J. Eby wrote:
> >
> >>cdef public object Text_Init():
> >>   ...
> >>   import Blender.Text as retval
> >>   return retval
> >
> >But Text_Init needs to return the object to be put in Blender by the
> >name Text, so this is recursive. 
> 
> There's nothing recursive about a Pyrex module importing
> itself. By the time any user-written initialisation code
> gets run, the module object has already been created and
> added to sys.modules, so it can be imported.
After initText() is called, I expect. I suspect it is known as "Text"
then rather than its proper name "Blender.Text". Perhaps I will test.

> But perhaps I don't correctly understand what you're
> trying to do. It sounded like you were re-implementing
> an existing extension module in Pyrex. If that's not the
> case, you'll have to elaborate.
Yes, I was as an experiment converting a couple of modules in Blender's
Python interface to Pyrex, partly to see how it works to embed it. They
are statically linked so the procedure was a bit different from
dynamically loaded modules.

-- 
PGP fingerprint = 9242 DC15 2502 FEAB E15F  84C6 D538 EC09 5380 5746
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20041108/5495e580/attachment.bin


More information about the Pyrex mailing list