Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'argument': 0.05; 'debugging': 0.07; 'exception,': 0.09; 'subject:skip:f 10': 0.09; 'wrapper': 0.09; 'bug': 0.12; 'called.': 0.16; 'expected,': 0.16; 'exception': 0.16; 'language': 0.16; 'wrote:': 0.18; 'stack': 0.19; 'mon,': 0.24; '15,': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'lines': 0.31; 'sep': 0.31; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'raising': 0.36; 'done': 0.36; 'method': 0.36; 'useful': 0.36; 'so,': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'first': 0.61; 'name': 0.63; 'here': 0.66; 'believe': 0.68; '5:15': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=MeooE7r47cqNmBJe+HnA/CzGoXYPCdJjxmBpw8E28X0=; b=ccAOjTtVK5ynCp+TIdT5bn+DOcw/ERHevNGVDAv2Dh3vOUoLCA5c+vx2w8bOZjNY5e g7OwiftMLKX7awFYQWQ8R4fgRRkXxN1aMMAWQfgHZPamfO1VfuxkstttN9k0rY9cXDAb kKY2MaEC/L0DQfN5x+u5vLNMq2yrn5X3ylbcGvW0/sH4GEoxIxRAzGoGGtOt8We6a5oI JiMpeMwU8immYKjJaFDNtm+xvxZEuIUrvH/51UkVY3dCINS0qvCVH0GIvvM/NLIeQmB0 oAKcHNwDRWLDoNWov/WUyB/gRlZ6GF/txiQrWeeWINDKUW18oZAsbFh2G0Tp3Zvz/qsb +ZmQ== X-Received: by 10.70.49.138 with SMTP id u10mr43299273pdn.6.1410838805232; Mon, 15 Sep 2014 20:40:05 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <541772fa$0$2078$426a74cc@news.free.fr> References: <541772fa$0$2078$426a74cc@news.free.fr> From: Ian Kelly Date: Mon, 15 Sep 2014 21:39:25 -0600 Subject: Re: functools.wraps behaviour To: Python Content-Type: text/plain; charset=UTF-8 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410838808 news.xs4all.nl 2917 [2001:888:2000:d::a6]:38713 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77912 On Mon, Sep 15, 2014 at 5:15 PM, ISE Development wrote: > The first two lines are as expected, using the name of the decorated > function. However, the exception uses the name of the decorating wrapper > function. > > Is this a bug in functools? Or is this a language feature? If so, is there a > valid argument to change this behaviour? I believe this is done in order to have useful stack traces. If it said 'method' in the stack trace, it could mislead the person debugging into thinking that method is actually raising the exception, but here the exception is actually coming from wrapped, and method is not even called.