[Python-Dev] Whether to call Py_Finalize when exiting from the child process of a fork from a spawned thread

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Sep 2 00:15:17 CEST 2009


Reid Kleckner wrote:

> On one hand, you may not want to call the user's atexit handlers
> multiple times from different processes if they have externally
> visible effects.  On the other hand, people seem to assume that
> Py_Finalize will be called at process exit to do various cleanups.  On
> the third hand, maybe Python could just clear out all the atexit
> handlers in the child after a fork.  So what should the correct
> behavior be?

Seems to me there's no single answer to that, because some
kinds of atexit handlers may need to be called in child
processes, while others may need *not* to be.

Maybe we need a flag when registering an atexit handler
to indicate whether it should be kept across forks?

-- 
Greg


More information about the Python-Dev mailing list