[Python-3000] python-safethread project status

Marcin ‘Qrczak’ Kowalczyk qrczak at knm.org.pl
Tue Mar 18 13:39:28 CET 2008


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.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/



More information about the Python-3000 mailing list