[Python-3000] python-safethread project status
Steven Bethard
steven.bethard at gmail.com
Tue Mar 18 16:21:22 CET 2008
On Tue, Mar 18, 2008 at 6:39 AM, Marcin 'Qrczak' Kowalczyk
<qrczak at knm.org.pl> wrote:
> Dnia 17-03-2008, Pn o godzinie 11:56 -0600, Adam Olsen pisze:
>
> > I've replaced __del__ API (which resurrected objects) with a
> > __finalize__/__finalizeattrs__ API (which doesn't). Attributes listed
> > in __finalizeattrs__ are proxied into a core object, a finalizer
> > thread is given a reference to the core, and when the main object is
> > deleted the GC asynchronously notifies the finalizer thread so that it
> > can call core.__finalize__(). The net result is an API very similar
> > to __del__ (you need to list attributes it might use), but it's now
> > impossible for the GC to run arbitrary code (I even enforce this).
>
> Ah! Irrespective of other issues, I like this very much. This design
> agrees with my understanding of how finalization should behave, except
> that I haven't had details in mind which would fit Python. My abstract
> design needs the finalization function to somehow access parts of the
> dying object, but not the object itself, and this design shows how to
> actually do it in a convenient way.
Note that you can use something very much like this right now::
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/519635
Steve
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000
mailing list