On 03/20, Nathaniel Smith wrote:
Modern CPython, and all extant versions of PyPy and Jython, guarantee that __del__ is called at most once. MicroPython doesn't support user-defined __del__ methods.
It's fine if the text wants to leave that open, but the current phrasing is pretty misleading IMO. I also read it as saying that __del__ would be called again if the object is collected again (which may or may not happen).
Yes, that is why I was confused. Just I could not believe nobody else noticed this "bug" so I decided to check the sources and yes, the code looks very clear.
But AFAICT there are actually zero implementations where this is true.
Probably this was mostly true until the commit 796564c2 ("Issue #18112: PEP 442 implementation (safe object finalization)."), python2 calls __del__ again.
Probably worth a small edit :-)
Agreed. And it seems that not only me was confused, http://doc.pypy.org/en/latest/cpython_differences.html says: There are a few extra implications from the difference in the GC. Most notably, if an object has a __del__, the __del__ is never called more than once in PyPy; but CPython will call the same __del__ several times if the object is resurrected and dies again. Thanks to all! Oleg.