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 <1353426274.57.0.0122851784982.issue16500@psf.upfronthosting.co.za>
In-reply-to
Content
> 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

  try:
    ...
  except:
    sys.excepthook(*sys.exc_info())

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.
History
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: <1353426274.57.0.0122851784982.issue16500@psf.upfronthosting.co.za>
2012-11-20 15:44:34sbtlinkissue16500 messages
2012-11-20 15:44:34sbtcreate