Being a bit confused after hacking Python

Michael Hudson mwh at python.net
Fri Aug 30 07:47:52 EDT 2002


Wolfgang Draxinger <wdraxinger at darkstargames.de> writes:

> *BUT* what/where the hell is the function that reload sys and invalids
> my changes I made juat after Py_Initialize, when there is no initfunc
> that can be called ???
> I must have missed something.

My failure to be able to answer this question has bugged me for weeks
now.

I found it, eventually.

This comment in Python/import.c is enlightening:

/* Magic for extension modules (built-in as well as dynamically
   loaded).  To prevent initializing an extension module more than
   once, we keep a static dictionary 'extensions' keyed by module name
   (for built-in modules) or by filename (for dynamically loaded
   modules), containing these modules.  A copy of the module's
   dictionary is stored by calling _PyImport_FixupExtension()
   immediately after the module initialization function succeeds.  A
   copy can be retrieved from there by calling
   _PyImport_FindExtension(). */

Cheers,
M.

-- 
  In short, just business as usual in the wacky world of floating
  point <wink>.                        -- Tim Peters, comp.lang.python






More information about the Python-list mailing list