[Python-Dev] RE: CVS Python is unstable
Neil Schemenauer
nas@arctrix.com
Fri, 23 Mar 2001 06:08:24 -0800
On Fri, Mar 23, 2001 at 01:50:21AM -0500, Fred L. Drake, Jr. wrote:
> The change that's been identified as causing the problem was
> trying to remove the weak ref from the cycle detectors set of
> known containers as soon as the ref object was no longer a
> container.
I'm not sure what you mean by "no longer a container". If the
object defines the GC type flag the GC thinks its a container.
> When this is done by the tp_clear handler may be the problem;
> the GC machinery is removing the object from the list, and
> calls gc_list_remove() assuming that the object is still in the
> list, but after the tp_clear handler has been called.
I believe your problems are deeper than this. If
PyObject_IS_GC(op) is true and op is reachable from other objects
known to the GC then op must be in the linked list. I haven't
tracked down all the locations in gcmodule where this assumption
is made but visit_reachable is one example.
We could remove this restriction if we were willing to accept
some slowdown. One way would be to add the invariant
(gc_next == NULL) if the object is not in the GC list. PyObject_Init
and gc_list_remove would have to set this pointer. Is it worth
doing?
Neil