Boris Staletic <boris.stale...@gmail.com> added the comment:

The `multiprocessing.Process`, on Linux, ends up doing something like this:

pid = os.fork()
if pid == 0: os._exit()

Translated to C:

int main() {
    Py_Initialize();
    PyOS_BeforeFork();
    pid_t pid = fork();
    if (pid == 0) {
        PyOS_AfterFork_Child(); // Reinitializes stuff.
        _exit(0); // Child process exits without cleanup.
    }
    PyOS_AfterFork_Parent();
    Py_Finalize();
}

The call to `_exit()` happens in Lib/multiprocessing/popen_fork.py#L73

My attempts at cleaning this up resulted in even more problems.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43145>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to