[Python-Dev] Making weakref callbacks safe in cyclic gc
tim.one at comcast.net
Mon Nov 17 22:09:17 EST 2003
> A hack you say? Create a list the references itself (i.e. append
> itself). Append all the unreachable callbacks to it and remove them
> from the weakrefs. Put the list in the youngest generation. The
> next gc should clean it up.
Alas, we don't know we can get enough space for a list, and if we can't
we're stuck. Maybe Py_FatalError would be OK then, but I'd rather not. I
think I can abuse the weakref objects themselves to hold "the list", though.
Heh. Now *that's* a hack <wink>.
More information about the Python-Dev