Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'decorator': 0.09; 'exception.': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; '2.7': 0.14; 'called,': 0.16; 'email addr:udel.edu>': 0.16; 'email name:<tjreedy': 0.16; 'raised.': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:raised': 0.16; 'traceback.': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'example': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'logging': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'needed.': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'lines': 0.31; 'exceptions': 0.31; 'extract': 0.31; 'origin': 0.31; 'raised': 0.31; 'class': 0.32; 'url:python': 0.33; 'subject:the': 0.34; 'received:209.85': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'received:209': 0.37; 'pm,': 0.38; 'expect': 0.39; 'url:mail': 0.40; 'received:173': 0.61; 'from:charset:utf-8': 0.61; 'information': 0.63; '30,': 0.65; 'yes': 0.68; 'received:173.193': 0.84 X-Received: by 10.182.81.36 with SMTP id w4mr2774906obx.74.1414703578856; Thu, 30 Oct 2014 14:12:58 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: =?UTF-8?B?TsOpc3RvciBCb3Njw6Fu?= Date: Thu, 30 Oct 2014 16:42:38 -0430 Subject: Re: When using a decorator exceptions raised reference the decorator not the function To: Terry Reedy Content-Type: multipart/alternative; boundary=047d7b2e48ae47c36a0506aa5812 X-CalcanetUrano-MailScanner-Information: Please contact the ISP for more information X-CalcanetUrano-MailScanner-ID: 1Xjx1f-000Kur-Cl X-CalcanetUrano-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-CalcanetUrano-MailScanner-SpamCheck: X-CalcanetUrano-MailScanner-From: nestor.boscan@tcs.com.ve X-Spam-Status: No X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - urano.calcanet.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tcs.com.ve X-Get-Message-Sender-Via: urano.calcanet.com: authenticated_id: nestor.boscan@tcs.com.ve X-Source: X-Source-Args: X-Source-Dir: Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 77 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414707564 news.xs4all.nl 2974 [2001:888:2000:d::a6]:35665 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79976 --047d7b2e48ae47c36a0506aa5812 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks Terry Yes both lines where in the traceback using tb_next I got what I needed. Regards, N=C3=A9stor On Thu, Oct 30, 2014 at 1:36 PM, Terry Reedy wrote: > On 10/30/2014 8:33 AM, N=C3=A9stor Bosc=C3=A1n 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 > --047d7b2e48ae47c36a0506aa5812 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks Terry

Yes both lines where in th= e traceback using tb_next I got what I needed.

Reg= ards,

N=C3=A9stor

On Thu, Oct 30, 2014 at 1:36 PM, Terry= Reedy <tjreedy@udel.edu> wrote:
On 10/30/2014 8:33 AM, N=C3= =A9stor Bosc=C3=A1n wrote:

I'm using Python 2.7 and I'm creating a class decorator that extrac= t
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.=C2=A0 Post an example = where you do not intercept the exception.

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list

--047d7b2e48ae47c36a0506aa5812--