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 july
Recipients Antoine d'Otreppe, benjamin.peterson, brian.curtin, eklitzke, findepi, freakboy3742, july, ncoghlan, pitrou, yaubi
Date 2010-05-03.12:43:39
SpamBayes Score 9.234265e-06
Marked as misclassified No
Message-id <>
To Evan Klitzke (eklitzke):

>I'm also interested in seeing this fixed. In the current behavior,
>the following code doesn't work:
><<< start code
>from functools import wraps
>def magic(func):
>	@wraps(func)
>	def even_more_magic(*args):
>		return func(*args)
>	return even_more_magic
>class Frob(object):
>	@magic
>	@classmethod
>	def hello(cls):
>		print '%r says hello' % (cls,)
>>>> end code

This code _should not_ work.

[Unbound] classmethod object is not a method or a function, it is even not a callable; it is a descriptor (returning callable). So, it cannot be wrapped or decorated in such way.

If you want something like this to work, you probably should place @classmethod on the upper level (in other words, apply classmethod after all other decorators):

	def hello(cls):
		print '%r says hello' % (cls,)
Date User Action Args
2010-05-03 12:43:41julysetrecipients: + july, ncoghlan, pitrou, benjamin.peterson, Antoine d'Otreppe, findepi, brian.curtin, eklitzke, yaubi, freakboy3742
2010-05-03 12:43:41julysetmessageid: <>
2010-05-03 12:43:39julylinkissue3445 messages
2010-05-03 12:43:39julycreate