[Python-Dev] Better module shutdown procedure

Neil Schemenauer nas at arctrix.com
Thu Oct 15 01:49:04 CEST 2009

Antoine Pitrou <solipsis at pitrou.net> wrote:
> Have you tried to remove the various hacks/workarounds in the
> stdlib that currently avoid module finalization problems?

Good idea. These hacks are the best argument for applying the
change, IMHO. I made a quick review of Lib modules using __del__:

    tarfile: looks not safe
    tempfile: goes through elaborate motions to avoid globals
    threading: yikes, I didn't attempt to decypher this one
    shelve: probably not safe
    dumbdb: avoids globals, easy to remove hacks
    _pyio: try/except can be removed (hopefully)
    urllib: avoids globals, easy to remove hacks
Will try to cook up a patch in my copious free time.


More information about the Python-Dev mailing list