Sorry but... no. It's not mandatory for any Python implementation, but the CPython interpreter collects any objects as soon as its reference count reaches zero, thus running the __del__ method.
https://docs.python.org/3/c-api/intro.html#reference-counts https://docs.python.org/3/reference/datamodel.html#object.__del__ On Friday, August 3, 2018 at 7:34:20 PM UTC+2, Christophe Pettus wrote: > > > > On Aug 3, 2018, at 07:23, [email protected] <javascript:> wrote: > > > > It seems to me this is a bug, but I'd like your opinions before actually > filing a bug report. > > I suspect what you are seeing there is a difference in garbage collection > behavior. __del__ is not run immediately upon the reference count reaching > 0; it's run when the object is garbage-collected, which can be some time > later. > > -- > -- Christophe Pettus > [email protected] <javascript:> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bb88a8dc-571a-478a-bd26-2606bf660c1c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

