[Python-Dev] regrtest.py mystery

Barry A. Warsaw barry@zope.com
Mon, 17 Dec 2001 11:18:42 -0500

>>>>> "Fred" == Fred L Drake, Jr <fdrake@acm.org> writes:

    Fred>   Useful or not, isn't the basic problem that we haven't
    Fred> been able to define The Right Thing?

Probably so.
    Fred> I'd certainly expect a module to be able to declare in some
    Fred> way that it could not be unloaded, or control how it gets
    Fred> unloaded.  Perhaps allow Python modules to define an
    Fred> __unload__() function; when unload() is called on a module,
    Fred> the __unload__() is called; if that raises an exception, it
    Fred> gets propogated, otherwise the unload continues if the
    Fred> module still exists in sys.modules.  Not clear that this
    Fred> would be useful for extensions.

The "unload protocol" would be I think.  I.e. extension modules ought
to be unloadable if they can cooperate.  From the Linux dl*()

       dlclose decrements the  reference  count  on  the  dynamic
       library  handle  handle.   If the reference count drops to
       zero and no other loaded libraries use symbols in it, then
       the  dynamic  library is unloaded.  If the dynamic library
       exports a routine named _fini, then that routine is called
       just before the library is unloaded.

season-to-tasste-on-your-favorite-OS-bread-l y'rs,