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 \__/ [EMAIL PROTECTED] ^^ http://qrnik.knm.org.pl/~qrczak/ _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com