[issue16500] Add an 'atfork' module

Richard Oudkerk report at bugs.python.org
Mon Oct 21 16:41:44 CEST 2013


Richard Oudkerk added the comment:

> - now that FDs are non-inheritable by default, fork locks around
> subprocess and multiprocessing shouldn't be necessary anymore? What
> other use cases does the fork-lock have?

CLOEXEC fds will still be inherited by forked children.

> - the current implementation keeps hard-references to the functions
> passed: so if one isn't careful, you can end up easily with a lot of
> objects kept alive just because of those references, which can be a
> problem

True, but you could make the same complaint about atexit.register().

One can fairly easily create something like weakref.finalize which uses atfork but is smart about not creating hard refs.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16500>
_______________________________________


More information about the Python-bugs-list mailing list