Turning a signature-changing decorator into a signature-preserving one
michele.simionato at gmail.com
Sat Feb 14 06:38:15 CET 2009
On Feb 14, 12:56 am, Gustavo Narea <m... at gustavonarea.net> wrote:
> Hello, everybody.
> I have this signature-changing decorator
> which I
> want to turn into a signature-preserving one. Here's my try
> but I get
> this error:http://paste.chrisarndt.de/paste/33e06be6e6d74e49b05c45534dfcc9fe?wra...
> What am I doing wrong? I think it looks like this example:http://pypi.python.org/pypi/decorator#async
> Thanks in advance.
> - Gustavo.
> PS: functols.wrap is not an option because my code has to work with
> Python 2.4+.
Difficult to see what is happening, since you have so many
dependencies. However, from the traceback I would say that
you are passing to the decorator a function with a __name__
attribute which is None. I would insert a call to pdb here
def __call__(self, func):
import pdb; pdb.set_trace()
return decorator(self.call, func)
and I would inspect func.__name__.
More information about the Python-list