Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77912

Re: functools.wraps behaviour

References <541772fa$0$2078$426a74cc@news.free.fr>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-09-15 21:39 -0600
Subject Re: functools.wraps behaviour
Newsgroups comp.lang.python
Message-ID <mailman.14040.1410838808.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Sep 15, 2014 at 5:15 PM, ISE Development <isenntp@gmail.com> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

functools.wraps behaviour ISE Development <isenntp@gmail.com> - 2014-09-16 01:15 +0200
  Re: functools.wraps behaviour Chris Angelico <rosuav@gmail.com> - 2014-09-16 10:46 +1000
    Re: functools.wraps behaviour ISE Development <isenntp@gmail.com> - 2014-09-16 09:24 +0200
  Re: functools.wraps behaviour Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-15 21:39 -0600

csiph-web