<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>>You shouldn't have to emulate that. The exact behavior of GC is allowed to vary between systems.</div>

<div>Yes, of course. I am looking into this for JyNI, which in contrast should emulate CPython behavior as good as possible.</div>

<div>And for such details, -one by one- I am currently weighting up whether it's easier to support it already in Jython or in the layer.</div>

<div>And for aspects where it is feasible, I see nothing wrong to get as close as possible to the reference implementation (and the persistence of weakrefs on resurrection seems to be none of these indeed).</div>

<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Sonntag, 26. Oktober 2014 um 06:53 Uhr<br/>
<b>Von:</b> "Guido van Rossum" <guido@python.org><br/>
<b>An:</b> "Stefan Richthofer" <Stefan.Richthofer@gmx.de><br/>
<b>Cc:</b> "python-dev@python.org" <python-dev@python.org><br/>
<b>Betreff:</b> Re: [Python-Dev] results of id() and weakref.getweakrefs() sometimes break on object resurrection</div>

<div name="quoted-content"><br/>
<br/>
On Saturday, October 25, 2014, Stefan Richthofer <<a href="Stefan.Richthofer@gmx.de" target="_parent">Stefan.Richthofer@gmx.de</a>> wrote:

<blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex;border-left: 1.0px rgb(204,204,204) solid;padding-left: 1.0ex;">Okay, sorry, I was thinking too Jython-like. I fixed runGC() just to<br/>
see now that it does not even trigger resurrection, since under<br/>
CPython there are no finalizers executed in ref cycles (i.e. I find my<br/>
objects in gc.garbage).<br/>
So I realize, my xy_cyclic tests are pointless anyway since in cyclic<br/>
gc no resurrection can happen.<br/>
<br/>
> The second problem (with weakref) is different: weakrefs are cleared<br/>
> before __del__ is called, so resurrection doesn't affect the whole<br/>
> process.<br/>
It appears weakrefs are only cleared if this is done by gc (where no<br/>
resurrection can happen anyway). If a resurrection-performing-__del__ is<br/>
just called by ref-count-drop-to-0, weakrefs persist - a behavior that is<br/>
very difficult and inefficient to emulate in Jython, but I'll give it<br/>
some more thoughts...<br/>
 </blockquote>

<div>You shouldn't have to emulate that. The exact behavior of GC is allowed to vary between systems.</div>

<div> </div>

<blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex;border-left: 1.0px rgb(204,204,204) solid;padding-left: 1.0ex;">However thanks for the help!<br/>
<br/>
-Stefan<br/>
<br/>
<br/>
> Gesendet: Sonntag, 26. Oktober 2014 um 01:22 Uhr<br/>
> Von: "Antoine Pitrou" <<a>solipsis@pitrou.net</a>><br/>
> An: <a>python-dev@python.org</a><br/>
> Betreff: Re: [Python-Dev] results of id() and weakref.getweakrefs() sometimes break on object resurrection<br/>
><br/>
><br/>
> Hello Stefan,<br/>
><br/>
> On Sun, 26 Oct 2014 00:20:47 +0200<br/>
> "Stefan Richthofer" <<a>Stefan.Richthofer@gmx.de</a>> wrote:<br/>
> > Hello developers,<br/>
> ><br/>
> > I observed strange behaviour in CPython (tested in 2.7.5 and 3.3.3)<br/>
> > regarding object resurrection.<br/>
><br/>
> Your runGC() function is buggy, it does not run the GC under CPython.<br/>
> Fix it and the first problem (with id()) disappears.<br/>
><br/>
> The second problem (with weakref) is different: weakrefs are cleared<br/>
> before __del__ is called, so resurrection doesn't affect the whole<br/>
> process. Add a callback to the weakref and you'll see it is getting<br/>
> called.<br/>
><br/>
> In other words, CPython behaves as expected. Your concern is<br/>
> appreciated, though.<br/>
><br/>
> Regards<br/>
><br/>
> Antoine.<br/>
><br/>
><br/>
> _______________________________________________<br/>
> Python-Dev mailing list<br/>
> <a>Python-Dev@python.org</a><br/>
> <a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br/>
> Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/stefan.richthofer%40gmx.de" target="_blank">https://mail.python.org/mailman/options/python-dev/stefan.richthofer%40gmx.de</a><br/>
><br/>
_______________________________________________<br/>
Python-Dev mailing list<br/>
<a>Python-Dev@python.org</a><br/>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br/>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a></blockquote>
<br/>
<br/>
--<br/>
--Guido van Rossum (on iPad)</div>
</div>
</div>
</div></div></body></html>