On 1/18/07, "Martin v. Löwis"
Brett Cannon schrieb:
Anybody have any ideas on how to deal with this short of rewriting some codecs stuff so that they don't depend on global state in the module or just telling me to just live with it?
There is an old patch by Armin Rigo ( python.org/sf/812369 ), which attempts to implement shutdown based on gc, rather than the explicit clearing of modules. It would be good if that could be put to work; I don't know what undesirable side effects doing so would cause.
I will have a look.
Short of that, I don't think Python needs to support explicit deletion of the encodings module from sys.modules when somebody still has a reference to the search function. Don't do that, then.
=) Yeah. As of this moment I am leaving __builtin__, exceptions, encodings, codecs, encodings.utf_8, warnings, and sys. I am deleting all other modules after Py_Initialize finishes its thing. I need to do a security audit on all of those modules before I permanently let them stick around (which is what I was hoping to avoid). I am also hoping make the sys module not be required to stay since it is only there because of the amount of stuff that is put into the module before its __dict__ is cached by the import machinery. -Brett