[Python-Dev] update_wrapper should preserve staticmethod behavior
Antoine Pitrou
solipsis at pitrou.net
Wed Jun 11 19:48:54 CEST 2008
Calvin Spealman <ironfroggy <at> socialserve.com> writes:
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "<stdin>", line 3, in A
> File "<stdin>", line 5, in d
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/functools.py", line 33, in update_wrapper
> setattr(wrapper, attr, getattr(wrapped, attr))
> AttributeError: 'staticmethod' object has no attribute '__module__'
Well, if staticmethod doesn't mirror the original function's __module__
attribute, I'd say staticmethod is the culprit.
Since Python grew the update_wrapper function, it seems reasonable to ask
that all decorators (or decorator-alikes) provided with Python call
update_wrapper. Of course staticmethod is written in C, so is there a
C function somewhere providing the same functionality as update_wrapper does?
More information about the Python-Dev
mailing list