Again, how to write a cleanup function for a module in C

Lexy Zhitenev zhitenev at
Sat Mar 29 10:30:04 CET 2003

"Alex Martelli" <aleax at> wrote:
news:g8_ga.33370$i26.870013 at

> See standard Python library module atexit.
> Alex

Yes, Alex, but this method won't work if my program is killed by an
exception or by signal. The method that I use cleans things up on exception.

If I register a cleanup function in atexit while debugging, when most of
time my program terminates with an exception, my memory will leak

Possibly, there should be a PEP for that...

More information about the Python-list mailing list