On Mon, 27 Oct 2014 14:36:31 +0100 Stefan Richthofer <stefan.richtho...@gmx.de> wrote: > Your test program performs no resurrection of x. > > Interestingly, it does not change behavior if you write > > class X(object): > def __del__(self): > X.x = self > print ref() > > (Thanks for making me aware of this! My test-case was already > initially the more complex one given below) > > But if the resurrection occurs indirectly, the weakref persists:
It's not that resurrection occurs indirectly, it's that the object pointed to by "x2" always remains alive (first as an instance attribute of x, second as a class attribute of X *before x is deleted*). Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com