2012/11/20 Christian Heimes <rep...@bugs.python.org>
> IFF we are going to walk the hard and rocky road of exception handling,
> then we are going to need at least four hooks and a register function that
> takres four callables as arguments: register(prepare, error, parent,
> child). Each prepare() call pushes an error handling onto a stack. In case
> of an exception in a prepare handler, the error stack is popped until all
> error handlers are called. This approach allows a prepare handler to
> actually prevent a fork() call from succeeding.
FWIW, PyPy already has a notion of fork hooks:
Various subsystems (threads cleanup, import lock, threading.local...)
register their hook functions.
You may want to experiment from there :-)
A new "atfork" module would be easy to implement.
Amaury Forgeot d'Arc
Python-bugs-list mailing list