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

Antoine Pitrou solipsis at pitrou.net
Mon Oct 27 17:36:19 CET 2014

On Mon, 27 Oct 2014 17:23:23 +0100
Stefan Richthofer <stefan.richthofer at gmx.de> wrote:
> >You mean Jython deletes instance attributes before calling __del__ ?
> No. I think the term of "object resurrection" usually does not mean bringing
> back a deleted object in the sense that memory was already freed.
> I think it rather means that nothing referred to an object, so it was on the
> "kill-list" of gc or zero-ref-count macro.

"x2" does *not* have its refcount drop to zero, since it is still
referenced by x. In other words, "x2" can only be on a "kill list"
after "x" has been finalized, which can only be *after* __del__ was

If Jython does things differently, then certainly its behaviour is
incompatible with the common expectations of Python developers.



More information about the Python-Dev mailing list