[Python-Dev] PEP 556: Threaded garbage collection

Benjamin Peterson benjamin at python.org
Fri Sep 8 15:33:01 EDT 2017



On Fri, Sep 8, 2017, at 12:13, Antoine Pitrou wrote:
> On Fri, 08 Sep 2017 12:04:10 -0700
> Benjamin Peterson <benjamin at python.org> wrote:
> > I like it overall.
> > 
> > - I was wondering what happens during interpreter shutdown. I see you
> > have that listed as a open issue. How about simply shutting down the
> > finalization thread and not guaranteeing that finalizers are actually
> > ever run à la Java?
> 
> I don't know.  People generally have expectations towards stuff being
> finalized properly (especially when talking about files etc.).
> Once the first implementation is devised, we will know more about
> what's workable (perhaps we'll have to move _PyGC_Fini earlier in the
> shutdown sequence?  perhaps we'll want to switch back to serial mode
> when shutting down?).

Okay, I'm curious to know what ends up happening here then.

> 
> > - Why not run all (Python) finalizers on the thread and not just ones
> > from cycles?
> 
> Because a lot of code probably expects them to be run as soon as the
> last visible ref disappears.

But this assumption is broken on PyPy and sometimes already by CPython,
so I don't feel very bad moving away from it.


More information about the Python-Dev mailing list