[Python-Dev] Re: Pre-existing bug of the millennium (so far)
Tim Peters
tim.peters at gmail.com
Thu Oct 28 20:21:37 CEST 2004
[Tim]
> ...
>> Anyone have a bright idea? It's remarkable how long we've managed to go
>> without noticing that everything is disastrously broken here <0.9 wink>.
[Jim]
> Sure. Clearing cyclic trash can call Python code. If there
> are weakrefs to any of the cyclic trash, then those wekrefs can
> be used to resurrect the objects. Therefore, *before* clearing cyclic
> trash, we need to remove any weakrefs. If any of the weakrefs
> being removed have callbacks, then we need to save the callbacks
> and call them *after* all of the weakrefs have been cleared.
Thanks! Neil Schemenauer and I got together today, and talked each
other into believing this can be made to work, and that it's likely
the best solution too.
The devil's in the details, but this a generalization of the last
round of weakref vs. gc bugfixes, which got the effect of what you
suggest here except only for cyclic-trash weakref objects with weakref
callbacks. It needs generalization to all weakly-referenced
cyclic-trash objects. Still unsure how hard that will be to code up,
but am sure it will fix all the test cases I concocted.
More information about the Python-Dev
mailing list