eyal.lotem+pyutils <at> gmail.com <eyal.lotem <at> gmail.com> writes: > > 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.
But if we use gcmodule's current linked list mechanisme, wouldn't this situation be correctly handled by _PyObject_GC_UNTRACK? That is, before the object is destroyed, the gc module already automatically removes it from its current "collection". Therefore, walking the collection (in this case, the list of unreachable objects) still does the right thing. (ISTM the gc relies heavily on this property) > Then, you might want to disable the > normal __del__ calling that occurs as part of the later destruction of > the cycle. I was thinking a flag in the PyObject header would do the trick but there aren't any flags in the PyObject header... *gasp*. _______________________________________________ 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