When using a decorator exceptions raised reference the decorator not the function

Néstor Boscán nestor.boscan at tcs.com.ve
Thu Oct 30 22:12:38 CET 2014


Thanks Terry

Yes both lines where in the traceback using tb_next I got what I needed.

Regards,

Néstor

On Thu, Oct 30, 2014 at 1:36 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 10/30/2014 8:33 AM, Néstor Boscán wrote:
>
>  I'm using Python 2.7 and I'm creating a class decorator that extract
>> information from exceptions for logging purposes.
>>
>> Everytime an exception is raised from the original function and I
>> extract the origin of the exception with sys.exc_info() I get a
>> reference to the line in the decorator where the function is called, not
>> the line of the original function where the exception was raised.
>>
>
> I expect that both lines should be in the traceback.  Post an example
> where you do not intercept the exception.
>
> --
> Terry Jan Reedy
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141030/b86c7532/attachment.html>


More information about the Python-list mailing list