This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author freakboy3742
Recipients Antoine d'Otreppe, benjamin.peterson, brian.curtin, eklitzke, findepi, freakboy3742, ncoghlan, pitrou
Date 2010-03-12.13:00:31
SpamBayes Score 1.91513e-14
Marked as misclassified No
Message-id <>
As an extra data point: we just hit this problem in Django ticket #13093 ( In our case, a decorator was using wraps(); however, that decorator was breaking when it was used on a class with a __call__ method, because the instance of the class doesn't have a __name__ attribute. 

We've implemented the proposed workaround (i.e., check the attributes that are available and provide that tuple as the assigned argument), but I don't agree that this should be expected behavior. wraps() is used to make a decorated callable look like the callable that is being decorated; if there are different types of callable objects, I would personally expect wraps() to adapt to the differences, not raise an error if it sees anything other than a function. 

True, some attributes (like __doc__) won't always be correct as a result of wrapping on non-vanilla functions -- but then, that's true of plain vanilla functions, too. A decorator wrapping a function can fundamentally change what the wrapped function does, and there's no guarantee that the docstring for the wrapped function will still be correct after decoration.
Date User Action Args
2010-03-12 13:00:33freakboy3742setrecipients: + freakboy3742, ncoghlan, pitrou, benjamin.peterson, Antoine d'Otreppe, findepi, brian.curtin, eklitzke
2010-03-12 13:00:33freakboy3742setmessageid: <>
2010-03-12 13:00:32freakboy3742linkissue3445 messages
2010-03-12 13:00:31freakboy3742create