On Jun 29, 5:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 29, 3:36 pm, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > > > eyal.lotem+pyutils <at> gmail.com <eyal.lotem <at> gmail.com> writes: > > > > That would be no worse than what happens now - but its still not > > > perfect (__del__ ordering issues). Also, you would need to temporarily > > > revive the cycles as mentioned above (to avoid accessibility of > > > partially destructed objects). > > > The idea is to call all __del__'s *before* any object in the cycle is > > deallocated (that is, call them manually rather than as part of deallocating > > them). That way you shouldn't have the issues mentioned above. > > Firstly, as I said above: you will still have __del__ ordering issues. > Secondly, the destructor itself currently calls __del__, so if you > call __del__ before any deallocation, it will get called again as part > of the deallocation. Might be a technicality but it will still > probably require some code restructuring to work around (or making > that code even more hairy).
Additionally, there is another problem: If the cycle is not temporarily revived, and you call __del__ manually, it may break the cycle by removing the references. Thus, objects in the cycle will go down to refcount=0 during your attempt to call __del__'s on the objects in the cycle. The only sane thing is to temporarily revive the entire cycle so you can safely call __del__'s on it. Then, you might want to disable the normal __del__ calling that occurs as part of the later destruction of the cycle. > > > _______________________________________________ > > Python-Dev mailing list > > [EMAIL PROTECTED]://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe:http://mail.python.org/mailman/options/python-dev/python-dev2-garchiv... > > _______________________________________________ > Python-Dev mailing list > [EMAIL PROTECTED]://mail.python.org/mailman/listinfo/python-dev > Unsubscribe:http://mail.python.org/mailman/options/python-dev/python-dev2-garchiv... _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com