Victor,

I think the design should be a bit different.

Instead of passing 'exc_info', we can pass 'traceback' key, like
in the snippet below:

    self.call_exception_handler({
        'message': 'socket.accept() out of system resource',
        'exception': exc,
        'traceback': sys.exc_info()[2],
        'socket': sock,
    })

This way, apps written for Trollius will be easier to port
to asyncio (in 3.4.1 we can fix call_exception_handler to remove
traceback from the context, if ``context['traceback']`` is the same
as ``context['exception'].__traceback__``)


Yury

On 2/25/2014, 9:23 AM, Victor Stinner wrote:
Hi,

In Python 2, an exception has no __traceback__ attribute. Calling
call_exception_handler() with the exception is not enough to get the
traceback.

I propose to add new exc_info key to the context in Trollius. If
exc_info is True, pass sys.exc_info() to the logger. Could you please
review:
http://codereview.appspot.com/68560043

By the way, it looks like there is no unit test checking that the
exception handler logs a traceback. See also my issue proposing to log
where a Future was created, it adds some tests on the traceback (but
not directly related to call_exception_handler):

http://code.google.com/p/tulip/issues/detail?id=137
https://codereview.appspot.com/64900043/

Victor

Reply via email to