[python-tulip] Event loop error handler

2014-02-06 Thread Yury Selivanov
As discussed with Guido in issue #80 (https://code.google.com/p/tulip/issues/detail?id=80), I'm proposing a strawman design for having a user definable event loop handler for unhandled exceptions. Two new API points: - loop.set_exception_handler(callback) Sets 'callback' as a new

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Guido van Rossum
On Thu, Feb 6, 2014 at 8:53 AM, Yury Selivanov yselivanov...@gmail.comwrote: As discussed with Guido in issue #80 (https://code.google.com/p/tulip/issues/detail?id=80), I'm proposing a strawman design for having a user definable event loop handler for unhandled exceptions. Two new API

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Yury Selivanov
On 2/6/2014, 1:24 PM, Guido van Rossum wrote: On Thu, Feb 6, 2014 at 8:53 AM, Yury Selivanov yselivanov...@gmail.comwrote: As discussed with Guido in issue #80 (https://code.google.com/p/tulip/issues/detail?id=80), I'm proposing a strawman design for having a user definable event loop handler

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Guido van Rossum
On Thu, Feb 6, 2014 at 12:09 PM, Yury Selivanov yselivanov...@gmail.comwrote: On 2/6/2014, 1:24 PM, Guido van Rossum wrote: On Thu, Feb 6, 2014 at 8:53 AM, Yury Selivanov yselivanov...@gmail.com wrote: As discussed with Guido in issue #80

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Yury Selivanov
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

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Victor Stinner
Hi, 2014-02-06 17:53 GMT+01:00 Yury Selivanov yselivanov...@gmail.com: I'm proposing a strawman design for having a user definable event loop handler for unhandled exceptions. With my short experience of asyncio, I can say that it's a pain to reconnect an unhandled exception to the future and

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Victor Stinner
However, I'm not sure how passing the future/handle to the handler may help. You have the name of the failed callback in the traceback of the exception. And, in many places all you have is just the failed callback function, and no related future or task. I'm talking about Future destructor

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Yury Selivanov
On 2/6/2014, 5:34 PM, Victor Stinner wrote: Install an handler for unhandled exceptions is not something new: there is already sys.displayhook and sys.excepthook. I'm not sure that it's useful to get the default handler. Just give access to the current handler. So when you setup a new handler,

Re: [python-tulip] Event loop error handler

2014-02-06 Thread Guido van Rossum
On Thu, Feb 6, 2014 at 2:54 PM, Yury Selivanov yselivanov...@gmail.comwrote: A question to you and Guido: should the callback receive three arguments: loop, exception, and context, where context is a namedtuple (so we can add new fields to it in future releases). For now, 'context' can have