On 2/6/2014, 3:44 PM, Guido van Rossum wrote:
[snip]
I'm not sure. The default exception handler may, over time, develop some useful custom behavior, and it's not like its signature is very complicated or using it is fraught with problems. So I don't see much downside to letting users call loop.default_exception_handler(). My suggestion would be two extra event loop methods: loop.default_exception_handler(exception, message) loop.call_exception_handler(exception, message) The former is the default handler. The latter calls the handler you set, if you set one, otherwise the default handler.

So let me reiterate on the proposed design:


loop.set_exception_handler(handler)
   Sets 'handler' as a new unhandled exceptions handler.

   If 'handler' is a callable object, then it should
   have the following signature (or compatible one):
   "(loop, exception, message)".

   If 'callback' is None, default event loop exceptions
   handler will be set.


loop.default_exception_handler(exception, message)
   Triggers default exceptions handler of the event loop.


loop.call_exception_handler(exception, message)
   Triggers the exceptions handler set with
   'set_exception_handler'.

   If there was no custom exceptions handler set, the
   default one is triggered.


Yury

Reply via email to