On Tue, Sep 1, 2009 at 2:58 PM, "Martin v. Löwis"<mar...@v.loewis.de> 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? > > Standard POSIX fork semantics should be a guidance. IIUC, termination > of the last thread is equivalent to calling exit(0) (although return > from main() still means that exit is invoked right away, and the return > value of main is the exit code - right?). Calling exit means to call > all exit handlers.
It depends, there is also _exit, which exists solely for the purpose of working around exit handlers being called from a forked child process at exit. Which semantics should Python have? In my opinion, it is more obvious that the user's handlers would be called than not, so I agree with you. Reid _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com