A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-October/136787.html below:

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

[Python-Dev] results of id() and weakref.getweakrefs() sometimes break on object resurrection [Python-Dev] results of id() and weakref.getweakrefs() sometimes break on object resurrectionAntoine Pitrou solipsis at pitrou.net
Mon Oct 27 15:14:22 CET 2014
On Mon, 27 Oct 2014 14:36:31 +0100
Stefan Richthofer <stefan.richthofer at 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.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4