[Python-Dev] Unloading modules (regrtest.py mystery)
Tim Peters
tim.one@home.com
Mon, 17 Dec 2001 21:42:51 -0500
[MAL]
> ...
> Would be nice if we could come up with a reasonable way of unloading
> modules, but I guess this requires some hard PEP work...
Yes, I believe it would. There are different kinds of unloading too: a
module may well want to do different things depending on whether, e.g., it's
really a reload, or it's because Py_Finalize was called ... hmm! That
reminds me: Guido sent me this msg in March; it's still sitting in my inbox
waiting for a rainy day:
"""
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)
"""
There. Somebody double the word count and call it a PEP <wink>.
Note that this is orthogonal to regrtest -r's woes.