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 eklitzke
Recipients Antoine d'Otreppe, benjamin.peterson, eklitzke, findepi, ncoghlan, pitrou
Date 2010-01-14.00:50:39
SpamBayes Score 1.88682e-12
Marked as misclassified No
Message-id <>
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):
	def even_more_magic(*args):
		return func(*args)
	return even_more_magic

class Frob(object):
	def hello(cls):
		print '%r says hello' % (cls,)
>>> end code

It fails because classmethods don't have a __module__ attribute, as commented upon elsewhere in this issue. To fix this, you'd either have to either pass in an `assigned` parameter to the `wraps` function, or swap the order of decorator application (i.e. `classmethod(magic(hello))`).

This seems arbitrary and unnecessarily complex; skipping over a missing __module__ should be just fine. Mixing `functools.wraps` and `classmethod` is a relatively common use case that should be as simple as possible.

I've attached a trivial patch which just ignores missing "assigned" attributes.
Date User Action Args
2010-01-14 00:50:41eklitzkesetrecipients: + eklitzke, ncoghlan, pitrou, benjamin.peterson, Antoine d'Otreppe, findepi
2010-01-14 00:50:41eklitzkesetmessageid: <>
2010-01-14 00:50:40eklitzkelinkissue3445 messages
2010-01-14 00:50:39eklitzkecreate