Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'decorator': 0.09; 'subject:using': 0.09; 'python': 0.11; '2.7': 0.14; 'called,': 0.16; 'raised.': 0.16; 'subject: \n ': 0.16; 'subject:raised': 0.16; 'exception': 0.16; 'creating': 0.23; 'logging': 0.26; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'exceptions': 0.31; 'extract': 0.31; 'origin': 0.31; 'raised': 0.31; 'class': 0.32; 'subject:the': 0.34; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'from:charset:utf-8': 0.61; 'information': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=aADsSXlwVzTyimPV6i5pKmpPLmcpryzdtY0wWOMWZcw=; b=ym82CmUMr0N9hJn35MIE04qOpZ6gcF0BpLaIiqe0SAhCzNUwyVMwhRKKg5haj2tggJ axv0WIxSEWIAWe7f7i3UrBiThB49mRAHGY04QpalETpixIud4OiRPRRWQYnsN9pBPjLr dkwQ1Vu3hZRz0+PKKjR7BComLeR1JEP9NM2etbqX8WQ5+BCut1jjjHyeTmxuDiPpTAX2 yAwI4eNZyWihcCrEM48YXhBLn6MOK4VlP4r5udseVB3UgQ5TBDSKGfx69eZ3OiNZKOI9 DI8nSqwWUUgcpw/lWt0vCTbJjnef8/zIJc8y8EU/bi1gXCjpjSQAqXuq4xq5wgrMC1Mp bbEw== X-Received: by 10.202.86.82 with SMTP id k79mr12941182oib.58.1414672457374; Thu, 30 Oct 2014 05:34:17 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?TsOpc3RvciBCb3Njw6Fu?= Date: Thu, 30 Oct 2014 08:03:57 -0430 Subject: When using a decorator exceptions raised reference the decorator not the function To: python-list@python.org Content-Type: multipart/alternative; boundary=001a113df3fa4baac80506a3199a X-Mailman-Approved-At: Thu, 30 Oct 2014 13:36:00 +0100 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414672561 news.xs4all.nl 2880 [2001:888:2000:d::a6]:60114 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79953 --001a113df3fa4baac80506a3199a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi 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. Any ideas? Regards, N=C3=A9stor --001a113df3fa4baac80506a3199a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi

I'm using Python 2.7 and I'm= creating a class decorator that extract information from exceptions for lo= gging purposes.

Everytime an exception is raised f= rom the original function and I extract the origin of the exception with sy= s.exc_info() I get a reference to the line in the decorator where the funct= ion is called, not the line of the original function where the exception wa= s raised.

Any ideas?

Rega= rds,

N=C3=A9stor
--001a113df3fa4baac80506a3199a--