[Python-Dev] Marking GC details as CPython-only

Maciej Fijalkowski fijall at gmail.com
Wed Feb 13 19:48:08 CET 2013


Hi

I've tried (and failed) to find what GC details (especially finalizer
semantics) are CPython only and which ones are not. The best I could
find was the documentation of __del__ here:
http://docs.python.org/2/reference/datamodel.html

Things were pypy differs:

* finalizers in pypy will be called only once, even if the object is
resurrected. I'm not sure if this is detail or we're just plain
incompatible.

* pypy breaks cycles and runs finalizers in random order (but
topologically correct), hence gc.garbage is always empty. I *think*
this part is really just an implementation detail

* we're discussing right now about running multiple finalizers. We
want to run them in order, but if there is a link a -> b and a becomes
unreachable, we want to reserve the right to call finalizer a then
finalizer b, even if a.__del__ resurrects a. What do you think?

Overall, the __del__ is baaad.

Cheers,
fijal


More information about the Python-Dev mailing list