Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Stefan Behnel <stefan_ml-KjMAwuNBv5izQB+pC5nmwQ <at> public.gmane.org>
Subject: Re: [Cython] [cython-users] cleaning up in a module
Newsgroups: gmane.comp.python.cython.devel
Date: Wednesday 29th February 2012 14:41:29 UTC (over 4 years ago)
Stefan Behnel, 29.02.2012 14:42:
> Stefan Behnel, 29.02.2012 14:34:
>> Henry Gomersall, 29.02.2012 14:30:
>>> What's the preferred way to clean up a C library when a module is
>>> deleted?
>>
>> PEP 3121:
>>
>> http://www.python.org/dev/peps/pep-3121/
>>
>> However, given that CPython doesn't currently support unloading
extension
>> modules, your question is rather hypothetical.
> 
> Oh, what you *can* do, however, is register an "atexit" function that
does
> the cleanup when the interpreter terminates.

Speaking of which, what about allowing users to implement a function

cdef void __dealloc__()

at the module level, which would then be called by the module cleanup
function (if generated) before running the rest of the cleanup code?

That would allow for an easier transition of user code towards a better
support of PEP 3121, specifically m_clear().

http://trac.cython.org/cython_trac/ticket/218

Stefan
 
CD: 3ms