This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Date 2004-10-29.16:41:19
SpamBayes Score
Marked as misclassified
Logged In: YES 

Bingo.  This is a bit delicate <heh>.  It's still necessary to call 
_PyWeakref_ClearRef() on a trash weakref with a callback, to 
prevent the callback from ever triggering (that was the key 
to fixing the previous pile of bugs).  For all other weakrefs to 
trash, I think you're right that just setting wr_object to None 
is conceptually enough.  But ...

What I pissed away the last half hour discovering is that if 
you set wr_object to None *before* calling 
_PyWeakref_ClearRef(), then the latter doesn't do anything, 
because clear_weakref() doesn't do anything when wr_object 
is None.

So that leaves me a little worried:  if we just set wr_object 
to None on some weakrefs, then PyObject_ClearWeakrefs() 
will never (and for the same reason) remove such a weakref 
from its doubly-linked list either.  Doesn't look like the 
weakref code intended that this be possible, and I'm not yet 
entirely convinced it can't hurt ...
Date User Action Args
2007-08-23 14:27:07adminlinkissue1055820 messages
2007-08-23 14:27:07admincreate