This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients amaury.forgeotdarc, asvetlov, christian.heimes, gregory.p.smith, sbt, twouters
Date 2012-11-20.15:44:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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.

I think there are two main options if a prepare callback fails:

1) The fork should not occur and the exception should be raised
2) The fork should occur and the exception should be only be printed

I favour option 1 since, if they want, users can always wrap their prepare callbacks with


With option 1 I don't see why error callbacks are necessary.  Just unwind the stack of imaginary try...finally... clauses and let any exceptions propagate out using exception chaining if necessary.  This is what pure-python-atfork.patch does.  Note, however, that if the fork succeeds then any subsequent exception is only printed.
Date User Action Args
2012-11-20 15:44:34sbtsetrecipients: + sbt, twouters, gregory.p.smith, amaury.forgeotdarc, christian.heimes, asvetlov
2012-11-20 15:44:34sbtsetmessageid: <>
2012-11-20 15:44:34sbtlinkissue16500 messages
2012-11-20 15:44:34sbtcreate