[Python-Dev] results of id() and weakref.getweakrefs() sometimes break on object resurrection

Antoine Pitrou solipsis at pitrou.net
Mon Oct 27 16:31:12 CET 2014


On Mon, 27 Oct 2014 16:20:06 +0100
Stefan Richthofer <stefan.richthofer at gmx.de> wrote:
> 
> I already pointed out
> "One can surely argue x2 has never been dead, or see it as
> "it was killed along with x and then resurrected by x"."
> 
> In Java and thus in Jython, it is treated as the second one.

You mean Jython deletes instance attributes before calling __del__ ?
That would make most __del__ implementations quite useless...
And actually your own example would fail with an AttributeError on
"X.y = self.z".

> What would still be interesting (at least when Jython 3 is born),
> is which of the mentioned behaviors occurs if it is
> performed by CPython's cyclic gc (consistently the first one I would guess).

In which use case exactly? :-) I've lost track a bit, since you've
posted several examples...

Regards

Antoine.


More information about the Python-Dev mailing list