Nick Coghlan added the comment: There's an interesting backwards compatibility challenge here. We definitely need to fix the misbehaviour, since it can lead to some pretty serious bugs in user code when attempting to bypass the LRU cache decorator if the wrapped function itself had a __wrapped__ attribute.
However, Michael tells me that at least some third party clients of the introspection tools assumed the "__wrapped__ points to the bottom of the wrapper stack" behaviour was intentional rather than just me screwing up the implementation. The existing docs for update_wrapper are unfortunately ambiguous because they use the term "original function" instead of "wrapped function". ---------- nosy: +michael.foord, rhettinger title: functools.update_wrapper doesn't overwrite attributes correctly -> functools.update_wrapper mishandles __wrapped__ versions: +Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17482> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com