[Python-3000] Draft PEP: Module Initialization and finalization

Tim Peters tim.peters at gmail.com
Wed Apr 12 06:47:33 CEST 2006


[Martin v. Löwis]
> Abstract: Module initialization currently has a few deficiencies.
> There is no cleanup for modules, the entry point name might give
> naming conflicts, the entry functions don't follow the usual
> calling convention, and multiple interpreters are not supported
> well. This PEP addresses these issues.
> ...

This sounds like a good time to reproduce the body of an email that's
been sitting in my inbox since March of 2001.  Since I didn't ask for
permission to reproduce it, I'll only reveal that it was written by
the Guido you're thinking of:

"""
OK, so we need to define a way for modules to specify a function to be
called at cleanup time.  I propose that we bring this out in the open,
at least in python-dev.  Note that there are three or four potential
cleanup times:

- when the module object is deleted from sys.modules

- when reload() is used on an extension

- when an interpreter created with PyInterpreter_New() is finalized

- when Py_Finalize() is called

- when Python exits

- when the Python DLL is unloaded (Windows only)

Good luck!
"""

PythonLabs never found the bandwidth for this, as we all spent the
next year trying to teach Barry how to use Unicode.  I don't even
remember what the thread above was about, but it would be great if the
PEP contained enough relevant words that I could finally clean that
message out of my inbox ;-)


More information about the Python-3000 mailing list