How to call cleanup code in a Python extension module

Skip Montanaro skip at pobox.com
Thu Jun 21 11:26:07 EDT 2001


    Markus> ... I wonder where to put the cleanup code when the module is
    Markus> unloaded since I have not found a delxxx() function.

Take a look at the C atexit(3) library function.  Note that it will only get
called if your program terminates by a call to exit(3), which may not be the
case when an exception is raised.

-- 
Skip Montanaro (skip at pobox.com)
(847)971-7098




More information about the Python-list mailing list