13 Sep
2010
13 Sep
'10
12:25 p.m.
[Jim Jewett]
The last time I checked ... single-__del__ cycles were already handled OK.
[Antoine Pitrou]
They aren't: ...
Antoine's right, unless things have changed dramatically since last time I was intimate with that code. CPython's "cyclic garbage detection" makes no attempt to analyze cycle structure. It infers that all trash it sees must be in cycles simply because the trash hasn't already been collected by the regular refcount-based gc. The presence of __del__ on a trash object then disqualifies it from further analysis, but there's no analysis of cycle structure regardless. Of course it doesn't _have_ to be that way. Nobody cared enough yet to add a pile of new code to special-case cycles with a single __del__.