[Python-Dev] GC and ExtensionClass - a summary of the problem and a workaround

James Henstridge james@daa.com.au
Thu, 17 May 2001 15:33:17 +0800 (WST)


On Thu, 17 May 2001, Fredrik Lundh wrote:

> footnote: this is usually done in the module init function, *before*
> the call to Py_InitModule.  see:

The PyExtensionClass_Export() function requires a pointer to the module
dictionary so that it can add itself to the module.  Unfortunately this
requires that Py_InitModule to have been called before hand.

I guess this means that the current ExtensionClass API will need to be
modified in order to allow ExtensionClasses to be initialised before
Py_InitModule.

>
>     http://www.python.org/doc/FAQ.html#3.24
>
> if the garbage collector can run after Python calls a module's init-
> function, but before that module calls back into Python, anything
> can happen...

James.